#include <bits/stdc++.h>
#include "testlib.h"

using namespace std;

int n, k1, k2;
vector <int> a;

inline bool readAndCheckAnswer(InStream &in) {
    string s = in.readToken("[Yy][Ee][Ss]|[Nn][Oo]", "verdict");
    for (char &c : s)
        c = tolower(c);
    if (s == "no") {
        return false;
    }
    if (s != "yes") {
        in.quitf(_wa, "Must be Yes or No");
    }
    vector <int> used(n);
    for (int i = 0; i < n / 2; ++i) {
        int x = in.readInt(1, n, "c_i") - 1;
        int y = in.readInt(1, n, "d_i") - 1;
        if (used[x]) {
            in.quitf(_wa, "All peoples should be entering 1 time in pairs");
        }
        used[x] = 1;
        if (used[y]) {
            in.quitf(_wa, "All peoples should be entering 1 time in pairs");
        }
        if (a[x] + a[y] != k1 && (a[x] ^ a[y]) != k2) {
            in.quitf(_wa, "Bad pair #%d", i + 1);
        }
        used[y] = 1;
    }
    return true;
}

int main(int argc, char *argv[]) {
    registerTestlibCmd(argc, argv);

    n = inf.readInt();
    k1 = inf.readInt();
    k2 = inf.readInt();
    a.resize(n);
    for (int &i : a)
        i = inf.readInt();

    bool ok1 = readAndCheckAnswer(ans);
    bool ok2 = readAndCheckAnswer(ouf);

    if (ok1 == ok2) {
        quitf(_ok, "n=%d", n);
    }
    if (ok1 && !ok2) {
        quitf(_wa, "Jury have answer, but participant do not.");
    }
    if (ok2 && !ok1) {
        quitf(_fail, "Participant have answer, but jury do not.");
    }
}
