#include <bits/stdc++.h>
using namespace std;
const int N = 705, M = 2e6 + 5;
int a[M], n, m, K, pos[M], o[N], vis[N], bel[N];
deque <int> q[N];
int stk[M], top;
struct node {int id, x, y;};
vector <node> vec;
void func() {
	top = 0;
	scanf("%d%d%d", &n, &m, &K);
	for (int i = 1; i <= m; i++) scanf("%d", &a[i]);
//	freopen("meow.out", "r", stdin);
	int tot; scanf("%d", &tot);
	for (int i = 1; i <= n; i++) q[i].clear();
	int now = 0;
	for (int i = 1, id, x, y; i <= tot; i++) {
		scanf("%d", &id);
		if (id == 1) {
			scanf("%d", &x); now++;
			if (x > n || x < 1) {
				printf("1Wrong Answer!\n");
				exit(0);
			}
			if (q[x].size() && q[x].back() == a[now]) q[x].pop_back();
			else q[x].push_back(a[now]);
		} else {
			scanf("%d%d", &x, &y);
			if (x == y) {puts("2Wrong Answer!"); exit(0);}
			if (q[x].size() && q[y].size() && q[x].front() == q[y].front()) {
				q[x].pop_front(), q[y].pop_front();
			}
		}
	}
	for (int i = 1; i <= n; i++)
		if (q[i].size()) {
			puts("3Wrong Answer!"); exit(0);
		}
	printf("Accept!");
}
	
int main() {
//	freopen("meow.in", "r", stdin);
	int T; scanf("%d", &T);
	while (T--) func();
	return 0;
}