#include "testlib.h"
#include <bits/stdc++.h>
const int MAXN = 1e6 + 5;
int a[MAXN];
int main(int argc, char *argv[]) {
  registerTestlibCmd(argc, argv);
  int T = inf.readInt(1, 1000000, "T");
  for (int tc = 1; tc <= T; ++tc) {
    int n = inf.readInt(1, 1000000, "n");
    for (int i = 1; i <= n; ++i)
      a[i] = inf.readInt(1, 1000000000, "a_i");
    int k = ouf.readInt(1, n, "k");
    int last = 0;
    int sum = 0;
    for (int i = 1; i <= k; ++i) {
      int b = ouf.readInt(1, n, "b_i");
      if (b <= last) {
        quitf(_wa, "Indices are not strictly increasing: b[%d]=%d, previous=%d.", i, b, last);
      }
      last = b;
      sum = (sum + a[b]) % n;
    }
    if (sum != 0) {
      quitf(_wa, "Sum modulo n is not zero in test case %d.", tc);
    }
  }
  quitf(_ok, "Accepted.");
  return 0;
}
