#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <cstdio>
#include <algorithm>
#define DN 100005
using namespace std;

typedef vector<int>::iterator it;

int t,n,m,k,sp[DN];
int h[DN],lw[DN],sz,nr,wh[DN],viz[DN],in[DN];
vector<int> gr[DN],st,gc[DN],spec[DN];
int hask[DN],nivst[DN];

void d(int s) {
  h[s]=lw[s]=++sz;
  viz[s]=1; st.push_back(s);
  for(it i=gr[s].begin(); i!=gr[s].end(); ++i) {
    if(!h[*i]) d(*i);
    if(viz[*i]) lw[s]=min(lw[s],lw[*i]);
  }
  if(lw[s]==h[s]) {
    vector<int> cc;
    int tp;
    do {
      tp=st.back(); viz[tp]=0;
      cc.push_back(tp); st.pop_back();
    }while(tp!=s);
    ++nr;
    for(int i=0; i<cc.size(); ++i) {
    	wh[cc[i]]=nr;
    	//cout<<cc[i]<<' '<<nr<<'\n';
    }
  }
}

void sot() {
	int nc=0;
	vector<int> cand;
	for(int i=1; i<=nr; ++i) if(!in[i]) cand.push_back(i);
	for(;cand.size();) {
		++nc;
		vector<int> cnext;
		for(auto i : cand) {
			nivst[i]=nc;
			for(auto j : gc[i]) {
				--in[j];
				if(!in[j]) cnext.push_back(j);
			}
		}
		cand=cnext;
	}
	//cout<<"NIV:\n";
	//for(int i=1; i<=nr; ++i) cout<<nivst[i]<<' ';
	//cout<<'\n';
}

int main() {
	//freopen("input.txt","r",stdin);
	for(cin>>t;t--;) {
		cin>>n>>m>>k;
		for(int i=1; i<=k; ++i) cin>>sp[i];
		//NU UITA SA RESETEZI
		sz=nr=0; st.clear();
		for(int i=1; i<=n; ++i) {
			gr[i].clear(); gc[i].clear(); spec[i].clear();
			h[i]=lw[i]=wh[i]=viz[i]=hask[i]=in[i]=nivst[i]=0;
		}
		//GATA RESETAREA
		for(int i=1; i<=m; ++i) {
			int a,b; cin>>a>>b;
			gr[a].push_back(b);
		}
		for(int i=1; i<=n; ++i) if(!h[i]) d(i);

		for(int i=1; i<=k; ++i) {
			hask[wh[sp[i]]]=1;
			spec[wh[sp[i]]].push_back(sp[i]);
		}
		for(int i=1; i<=nr; ++i) sort(spec[i].begin(), spec[i].end());
		for(int i=1; i<=n; ++i) for(it j=gr[i].begin(); j!=gr[i].end(); ++j) {
			//cout<<"AICI"<<wh[i]<<' '<<wh[*j]<<'\n';
			if(wh[i]!=wh[*j]) {
				gc[wh[i]].push_back(wh[*j]);
				
				++in[wh[*j]];
			}
		}

		set<int> cand;
		vector<int> rez;
		int ok=1;
		for(int i=1; i<=nr; ++i) if(!in[i]) cand.insert(i);
		sot();
		while(ok && cand.size()) {
			//for(auto i : cand) cout<<i<<' ';
			//cout<<'\n';
			int cnt=0,sp;
			for(auto i : cand) if(hask[i]) {
				++cnt; sp=i;
			}
			set<int> cnext;
			if(cnt>1) ok=0;
			else if(cnt==1) {
				for(auto i : gc[sp]) if(nivst[i]==nivst[sp]+1) cnext.insert(i);
				for(auto i : spec[sp]) rez.push_back(i);
			} else {
				for(auto i : cand) for(auto j : gc[i]) if(nivst[j]==nivst[i]+1) cnext.insert(j);
			}
			cand = cnext;
			//for(int i=0; i<cand.size(); ++i) if(hask[cand[i]])
		}
		if(!ok || rez.size()<k) cout<<-1<<'\n';
		else {
			for(auto i : rez) cout<<i<<' ';
			cout<<'\n';
		}
		//ai grija sa ajunga toate nodurile in solutie
	}
}