#include<bits/stdc++.h>
using namespace std;
deque<int>dq[305];
int T,n,m,k,a[2000050];
int main(){
	FILE*fin=fopen("meow.in","r");
	FILE*fout=fopen("meow.out","r");
	fscanf(fin,"%d",&T);
	for(int Tc=1;Tc<=T;++Tc){
		fscanf(fin,"%d%d%d",&n,&m,&k);
		for(int i=1;i<=n;++i)dq[i].clear();
		for(int i=1;i<=m;++i)fscanf(fin,"%d",a+i);
		int op;
		fscanf(fout,"%d",&op);
		if(!(m<=op&&op<=2*m)){cout<<"WA on test "<<Tc<<'\n';return 0;}
		int dd=1;
		for(int i=1;i<=op;++i){
			int t,x,y;
			fscanf(fout,"%d",&t);
			if(t==1){
				fscanf(fout,"%d",&x);
				assert(1<=x&&x<=n);
				if(dd>m){cout<<"WA on test "<<Tc<<'\n';return 0;}
				if(dq[x].size()&&dq[x].back()==a[dd])
					dq[x].pop_back();
				else dq[x].push_back(a[dd]);
				++dd;
			}else{
				fscanf(fout,"%d%d",&x,&y);
				assert(1<=x&&x<=n);
				assert(1<=y&&y<=n);
				if(dq[x].size()&&dq[y].size()&&dq[x].front()==dq[y].front())
					dq[x].pop_front(),dq[y].pop_front();
			}
		}
		for(int i=1;i<=n;++i)
			if(dq[i].size()){
				cout<<"WA on test "<<Tc<<'\n';
				return 0;
			}
	}
	cout<<"Accepted\n";
	return 0;
}
