#include<bits/stdc++.h>
using namespace std;
#define int long long
#define db double
const int N = 1e5 + 5;
const int mod = 1e9 + 7;
const db eps = 1e-10;
void solve() {
int n, m, d;
cin >> n >> m >> d;
vector<vector<int>> q(n + 5);
vector<vector<int>> dis(n + 5, vector<int>(2, 1e9)), vis(n + 5, vector<int>(2)), vis2(n + 5, vector<int>(2)), dis2(
n + 5, vector<int>(2, 1e9));
vector<vector<int>>pre(n+5,vector<int>(2,0));
for (int i = 1, l, r; i <= m; i++) {
cin >> l >> r;
q[l].push_back(r);
q[r].push_back(l);
}
int k;
cin >> k;
queue<pair<int, int>> q1;
for (int i = 1, x; i <= k; i++) {
cin >> x;
q1.push({x, 0});
dis[x][0] = 0;
}
while (!q1.empty()) {
auto y = q1.front();
q1.pop();
if (vis[y.first][y.second % 2] || y.second == d)continue;
vis[y.first][y.second % 2] = 1;
for (auto j: q[y.first]) {
if( dis[j][(y.second+1) % 2]>y.second+1){
dis[j][(y.second+1) % 2]=y.second+1;
q1.push({j, y.second + 1});
}
}
}
q1.push({1, 0});
dis2[1][0] = 0;
vector<int> ans;
int f = 0;
int fx=0;
while (!q1.empty()) {
auto y = q1.front();
q1.pop();
// cout<<'\n';
// cout<<y.first<<" "<<y.second<<'\n';
if (y.first == n) {
f = 1;
fx=y.second%2;
break;
}
if (vis2[y.first][y.second % 2])continue;
vis2[y.first][y.second % 2] = 1;
for (auto j: q[y.first]) {
if (vis2[j][(y.second + 1)%2])continue;
if(dis[j][(y.second + 1)%2]>y.second+1){
if(y.second+1<dis2[j][(y.second + 1)%2]){
dis2[j][(y.second + 1)%2]=min( dis2[j][(y.second + 1)%2],y.second+1);
pre[j][(y.second + 1)%2]=y.first;
q1.push({j, y.second + 1});
}
}
}
}
// cout<<n<<" "<<fx<<'\n';
// cout<<dis2[n][fx]<<'\n';
if (f) {
int q=n;
ans.push_back(n);
while(1){
q=pre[q][fx];
fx^=1;
ans.push_back(q);
if(q==1&&fx==0)break;
}
int w1=ans.size();
cout<<w1-1<<'\n';
std::reverse(ans.begin(), ans.end());
for(int i=0;i<ans.size();i++){
cout<<ans[i]<<" ";
}cout<<'\n';
}else{
cout<<-1<<'\n';
}
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
//cout<<fixed<<setprecision(10);
int T = 1;
cin >> T;
while (T--)solve();
return 0;
}