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

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

public class Check implements Checker {
    public static final double EPS = 1e-7;

    final static int MAX_MOVES = 100;

    public Outcome test(InStream inf, InStream ouf, InStream ans) {
        int nMoves = ouf.nextInt();
        if (nMoves > MAX_MOVES) {
            return new Outcome(WA, "Too many moves: " + nMoves);
        }
        if (nMoves == -1) {
            ouf.nextLine();
            String desc = ouf.nextLine();
            return new Outcome(WA, desc);
        }
        if (nMoves == -2) {
            ouf.nextLine();
            String desc = ouf.nextLine();
            return new Outcome(PE, desc);
        }
        if (nMoves < 0) {
            ouf.nextLine();
            String desc = ouf.nextLine();
            return new Outcome(FAIL, "code " + nMoves + ", " + desc);
        }
        return new Outcome(OK, nMoves + " queries");
    }

}
