import ru.ifmo.testlib.Checker;
import ru.ifmo.testlib.InStream;
import ru.ifmo.testlib.Outcome;
import ru.ifmo.testlib.Outcome.Type;

import java.util.Arrays;

public class Check implements Checker {
    @Override
    public Outcome test(InStream inf, InStream ouf, InStream ans) {
        int n = inf.nextInt();
        a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = inf.nextInt();
        }
        
        b = new boolean[n][a[0]];
        for (int i = 0; i < n; i++) {
            Arrays.fill(b[i], false);
        }

        int m = ouf.nextInt();
        int jm = ans.nextInt();
        if (jm < m) {
            return new Outcome(Type.WA, "Number of rooks is not minimal");
        }
        
        int x, y;
        for (int i = 0; i < m; i++) {
            x = ouf.nextInt();
            y = ouf.nextInt();
            if (x < 1 || x > n) {
                return new Outcome(Type.WA, "Invalid rook coordinates: " + x + ", " + y);
            }
            if (y < 1 || y > a[x - 1]) {
                return new Outcome(Type.WA, "Invalid rook coordinates: " + x + ", " + y);
            }
            for (int j = 0; j < n; j++) {
                b[j][y - 1] = true;
            }
            for (int j = 0; j < a[x - 1]; j++) {
                b[x - 1][j] = true;
            }
        }

        for (int i = 0; i < n; i++) {
            for (int j = 0; j < a[i]; j++) {
                if (!b[i][j]) {
                    return new Outcome(Type.WA, "Uncovered position " + i + ", " + j + "");
                }
            }
        }

        return new Outcome(Type.OK, m + " rooks");
    }

    int[] a;
    boolean[][] b;
}
