import ru.ifmo.testlib.*;
import ru.ifmo.testlib.Outcome.Type;

public class Check implements Checker {
    @Override
    public Outcome test(InStream inf, InStream ouf, InStream ans) {
        try {
        int n = inf.nextInt();
        int l[] = new int[n];
        int r[] = new int[n];
        for (int i = 0; i < n; i++) {
            l[i] = inf.nextInt();
            r[i] = inf.nextInt();
        }
        int k1 = ouf.nextInt();
        int k2 = ans.nextInt();
        if (k1 < k2)
            return new Outcome(Type.WA, "Jury has better answer");
        if (k1 > k2)
            return new Outcome(Type.WA, "Too big number of items");
        int k = k1;
        int last = 0;
        boolean was[] = new boolean[n];
        for (int i = 0; i < k; i++) {
          int idx = ouf.nextInt() - 1;
          if (idx < 0 || idx > n - 1)
            return new Outcome(Type.WA, "Wrong index of item");
          if (was[idx])
            return new Outcome(Type.WA, "Some items are displayed multiple times");
          if (last > l[idx])
            return new Outcome(Type.WA, "Segments are intersect");
          was[idx] = true;
          last = r[idx];
        }

        return new Outcome(Type.OK, "OK!");
      } catch (Throwable e) {
            return new Outcome(Type.PE, "Something went wrong!");
      }
    }
}
