import java.math.*;
import java.util.*;

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

public class Check implements Checker {

    // -1 -- nothing
    // 0 -- wrong
    // 1 -- good
    int check(int n, InStream in) {
        int a[] = new int[2 * n];
        a[0] = in.nextInt();
        if (a[0] == -1) {
            return -1;
        }
        for (int i = 1; i < 2 * n; i++) {
            a[i] = in.nextInt();
        }
        ArrayList<Integer> e[] = new ArrayList[n + 2];
        for (int i = 0; i <= n + 1; i++) {
            e[i] = new ArrayList<Integer>();
        }
        for (int i = 0; i < 2 * n; i++) {
            if (a[i] < 0 || a[i] > n + 1) {
                return 0;
            }
            e[a[i]].add(i);
        }
        int cnt = 0;
        for (int i = 1; i <= n + 1; i++) {
            if (e[i].size() == 2 && e[i].get(1) - e[i].get(0) == i) {
                cnt++;
            }
        }
        if (cnt != n) return 0;
        return 1;
    }

    @Override
    public Outcome test(InStream inf, InStream ouf, InStream ans) {
        try {
            int n = inf.nextInt();
            int pAns = check(n, ouf);
            int jAns = check(n, ans);
        
            if (jAns == -1 && pAns == 1) {
                return new Outcome(Type.FAIL, "FAIL");
            }
            if (jAns == 0) {
                return new Outcome(Type.FAIL, "FAIL");
            }
            if (pAns <= 0) {
                return new Outcome(Type.WA, "WA");
            }
            return new Outcome(Type.OK, "OK");
        } catch (Throwable e) {
            return new Outcome(Type.PE, "Something went wrong!");
        }
    }
}
