import java.util.HashSet;

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

public class Check implements Checker {

	String rev(String a) {
		String res = "";
		for (int i = a.length() - 1; i >= 0; --i) {
			res += a.charAt(i);
		}
		return res;
	}

	String noSol = "Sorry, but I don't know answer!";

	@Override
	public Outcome test(InStream inf, InStream ouf, InStream ans) {
		int n = inf.nextInt();
		HashSet<Integer> inp = new HashSet<Integer>();
		for (int i = 0; i < n; i++) {
			inp.add(inf.nextInt());
		}
		String s = ouf.nextLine();
		if (s.equals(noSol)) {
			String s1 = ans.nextLine();
			if (s1.equals(noSol)) {
				s = ouf.nextLine();
				return new Outcome(Type.OK, "");
			} else {
				s = ouf.nextLine();
				return new Outcome(Type.WA, "You didn't find any solution");
			}
		}
		String[] ss = s.split(" ");
		if (ss.length != 3) {
			return new Outcome(Type.WA, "Wrong number of tokens");
		}
		int a, b, c;
		try {
			a = Integer.parseInt(ss[0]);
			b = Integer.parseInt(ss[1]);
			c = Integer.parseInt(ss[2]);
		} catch (NumberFormatException e) {
			return new Outcome(Type.PE, "Expected integer, found: " + s);
		}
		if (a == b || a == c || b == c) {
			return new Outcome(Type.WA, "Same numbers");
		}
		if (!inp.contains(a) || !inp.contains(b) || !inp.contains(c)) {
			return new Outcome(Type.WA, "Numbers not from input ");
		}
		String res = a + "" + b + "" + c;
		if (!res.equals(rev(res))) {
			return new Outcome(Type.WA, "Not palindrome");
		} else {
			String s1 = ans.nextToken();
			if (s1.charAt(0) == 'S') {
				return new Outcome(Type.FAIL, "Ooooops");
			}
			return new Outcome(Type.OK, res);
		}
	}

}
