#include <bits/stdc++.h>

using namespace std;

const int N = 5e5 + 1;
int a[N];
unordered_map <int, set <int>> g;
unordered_map <int, int> cnt;
unordered_map <int, int> used;
unordered_map <int, vector <int>> pos;

vector <int> cycle;

void dfs (int u) {
    used[u] = 1;
    cycle.push_back(u);
    for (int v : g[u]) {
        if (!used[v]) {
            dfs(v);
        }
    }
}

int main () {
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int n, k1, k2;
    cin >> n >> k1 >> k2;
    if (n % 2) {
        cout << "No\n";
        return 0;
    }
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        cnt[a[i]]++;
        pos[a[i]].push_back(i);
    }
    auto leap = [&](int x) {
        return (k1 - x == x || (k2 ^ x) == x);
    };
    vector <pair <int, int>> res;
    auto push_eq_one = [&](int x) {
        res.emplace_back(pos[x][cnt[x] - 1], pos[x][cnt[x] - 2]);
        pos[x].pop_back();
        pos[x].pop_back();
        cnt[x] -= 2;
    };
    auto push_eq = [&](int x) {
        while (cnt[x] > 0) {
            push_eq_one(x);
        }
    };
    auto push_pair = [&](int x, int y) {
        cnt[x]--; cnt[y]--;
        res.push_back({pos[x].back(), pos[y].back()});
        pos[x].pop_back();
        pos[y].pop_back();
    };
    if (k2 == 0) {
        for (int i = 0; i < n; ++i) {
            if (cnt[a[i]] == 0) {
                continue;
            }
            if (k1 - a[i] == a[i]) {
                if (cnt[a[i]] % 2 != 0) {
                    cout << "No\n";
                    return 0;
                }
                push_eq(a[i]);
            } else {
                int y = k1 - a[i];
                if ((cnt[a[i]] + cnt[y]) % 2 == 0) {
                    if (cnt[a[i]] % 2) {
                        push_pair(a[i], y);
                    }
                    push_eq(a[i]);
                    push_eq(y);
                } else {
                    cout << "No\n";
                    return 0;
                }
            }
        }
        cout << "Yes\n";
        for (auto [i, j] : res) {
            cout << i + 1 << ' ' << j + 1 << '\n';
        }
        return 0;
    }
    for (int i = 0; i < n; ++i) {
        if (cnt.find(k1 - a[i]) != cnt.end()) {
            g[a[i]].insert(k1 - a[i]);
        }
        if (cnt.find(a[i] ^ k2) != cnt.end()) {
            g[a[i]].insert(a[i] ^ k2);
        }
    }
    // bamboos
    for (int i = 0; i < n; ++i) {
        if (used[a[i]])
            continue;
        if (g[a[i]].size() <= 1) {
            cycle.clear();
            dfs(a[i]);
            int k = cycle.size();
            if (k == 1) {
                int x = cycle[0];
                if (leap(x) && cnt[x] % 2 == 0) {
                    push_eq(x);
                    continue;
                } else {
                    cout << "No\n";
                    return 0;
                }
            }
            for (int j = 1; j < k - 1; ++j) {
                if (cnt[cycle[j]] > cnt[cycle[j - 1]] + cnt[cycle[j + 1]]) {
                    cout << "No\n";
                    return 0;
                }
            }
            int x1 = cycle[0];
            int x2 = cycle.back();
            if (leap(x1)) {
                reverse(cycle.begin(), cycle.end());
                swap(x1, x2);
            }
            for (int j = 0; j < k - 1; ++j) {
                if (cnt[cycle[j]] > cnt[cycle[j + 1]]) {
                    cout << "No\n";
                    return 0;
                }
                while (cnt[cycle[j]] > 0) {
                    push_pair(cycle[j], cycle[j + 1]);
                }
            }
            if (!leap(x2) && cnt[cycle.back()] > 0) {
                cout << "No\n";
                return 0;
            }
            if (leap(x2) && cnt[cycle.back()] % 2) {
                cout << "No\n";
                return 0;
            }
            push_eq(x2);
        }
    }
    // cycles
    for (int i = 0; i < n; ++i) {
        if (used[a[i]]) {
            continue;
        }
        cycle.clear();
        dfs(a[i]);
        int k = cycle.size();
        for (int j = 0; j < k; ++j) {
            if (leap(cycle[j])) {
                rotate(cycle.begin(), cycle.begin() + j, cycle.end());
                break;
            }
        }
        int sum = 0;
        for (int j = 0; j < k; ++j) {
            sum += cnt[cycle[j]];
            int s = cnt[cycle[(j - 1 + k) % k]] + cnt[cycle[(j + 1) % k]];
            if (s < cnt[cycle[j]]) {
                cout << "No\n";
                return 0;
            }
        }
        if (sum % 2 == 1) {
            cout << "No\n";
            return 0;
        }
        if (leap(cycle[0])) {
            int s1 = cnt[cycle.back()] + cnt[cycle[1]];
            if ((cnt[cycle[0]] - s1) % 2) {
                cout << "No\n";
                return 0;
            }
            int kk = (cnt[cycle[0]] - s1) / 2;
            int xx = cycle[0];
            while (kk--) {
                cnt[xx] -= 2;
                push_eq_one(xx);
            }
        }
        vector <int> c;
        for (int j = 0; j < k; ++j) {
            c.push_back(cnt[cycle[j]]);
        }
        int ok = -1;
        {
            vector <int> d = c;
            int f = 1;
            for (int l = 0; l < k - 1; ++l) {
                d[l + 1] -= d[l];
            }
            int x = 0, y = c[0];
            for (int l = 0; l < k; ++l) {
                if (l % 2 == 0) {
                    y = min(y, d[l]);
                } else {
                    x = max(x, -d[l]);
                }
            }
            if (x <= y) {
                ok = x;
            }
        }
        if (ok == -1) {
            cout << "No\n";
            return 0;
        }
        for (int j = 0; j < ok; ++j) {
            push_pair(cycle[0], cycle.back());
        }
        for (int j = 0; j < k - 1; ++j) {
            while (cnt[cycle[j]] > 0) {
                push_pair(cycle[j], cycle[j + 1]);
            }
        }
    }
    cout << "Yes\n";
    for (auto [i, j] : res) {
        cout << i + 1 << ' ' << j + 1 << '\n';
    }
    return 0;
}
