#include "bits/stdc++.h"

using namespace std;

void solve () {
    int n, s, x;
    cin >> n >> s >> x;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    auto z = a;
    std::sort(z.begin(), z.end());
    z.resize(std::unique(z.begin(), z.end()) - z.begin());
    const int m = int(z.size());
    vector<int> cnt(m);
    vector id(m, vector<int> ());
    for (int i = 0; i < n; i++) {
        cnt[std::lower_bound(z.begin(), z.end(), a[i]) - z.begin()]++;
        id[std::lower_bound(z.begin(), z.end(), a[i]) - z.begin()].push_back(i);
    }
    vector g(m, vector<pair<int, int>> ());
    int edges = 0;
    vector<pair<int, int>> vedges;
    for (int i = 0; i < m; i++) {
        for (int val : vector<int> {s - z[i], z[i] ^ x}) {
            int it = std::lower_bound(z.begin(), z.end(), val) - z.begin();
            if (it < m && z[it] == val && it <= i) {
                g[i].push_back({it, edges});
                if (i != it) g[it].push_back({i, edges});
                edges++;
                vedges.push_back({i, it});
            }
        }
    }
    vector<pair<int, int>> ans;
    auto add = [&] (int i, int j) {
        if (!cnt[i] || !cnt[j]) return;
        ans.push_back({id[i].back(), 0});
        id[i].pop_back();
        ans.back().second = id[j].back();
        id[j].pop_back();
        cnt[i]--;
        cnt[j]--;
    };
    const long long inf = (long long) 1e18;
    vector<long long> k(edges, -inf), b(edges);
    vector<int> usd(m);
    for (int st = 0; st < m; st++) {
        if (usd[st] || g[st].empty()) continue;
        vector<int> qu = {st};
        usd[st] = 1;
        for (int it = 0; it < int(qu.size()); it++) {
            int v = qu[it];
            for (auto& [u, i] : g[v]) {
                if (!usd[u]) {
                    qu.push_back(u);
                    usd[u] = 1;
                }
            }
        }
        long long lx = 0, rx = cnt[st];
        bool even = false;
        bool odd = false;
        if (g[st][0].first == st) {
            even = true;
        } else {
            rx = min(rx, (long long) cnt[g[st][0].first]);
        }
        vector<int> id_edges = {g[st][0].second};
        k[g[st][0].second] = 1;
        b[g[st][0].second] = 0;
        qu = {st, g[st][0].first};
        for (int it = 0; it < int(qu.size()); it++) {
            int v = qu[it];
            long long K = 0, B = 0;
            int ei = -1;
            for (auto& [u, i] : g[v]) {
                if (k[i] == -inf) ei = i;
                else K += k[i], B += b[i];
            }
            if (ei == -1) continue;
//            debug(ei, K, B, g[v]);
            id_edges.push_back(ei);
            if (vedges[ei].first == vedges[ei].second) {
                // -Kx + (cnt[v] - B) is even
                if ((cnt[v] - B) % 2) {
                    if (K % 2) {
                        odd = true;
                    } else {
                        odd = even = true;
                    }
                } else {
                    if (K % 2) {
                        even = true;
                    }
                }
                k[ei] = -K;
                b[ei] = cnt[v] - B;
                for (auto& [u, i] : g[v]) {
                    if (i == ei) {
                        qu.push_back(u);
                    }
                }
                continue;
            }
            k[ei] = -K;
            b[ei] = cnt[v] - B;
            if (k[ei] == 1) {
                lx = max(lx, -b[ei]);
            } else {
                rx = min(rx, b[ei]);
            }
            for (auto& [u, i] : g[v]) {
                if (i == ei) {
                    qu.push_back(u);
                }
            }
        }
//        debug(odd, even, qu, id_edges, k, b, lx, rx);
//        debug(vedges);
        if (odd && even) continue;
        for (auto& v : qu) {
            long long K = 0, B = 0;
            for (auto& [u, i] : g[v]) {
                K += k[i], B += b[i];
            }
            // kx = cnt[v] - B
            B = cnt[v] - B;
            if (!K) {
                if (B) {
                    odd = even = true;
                }
            } else {
                long long val = B / K;
                lx = max(lx, val);
                rx = min(rx, val);
            }
        }
        if (odd) if (abs(rx % 2) != 1) rx--;
        if (even) if (rx % 2) rx--;
        if (lx <= rx) {
            for (auto& i : id_edges) {
                auto [v, u] = vedges[i];
                long long iters = k[i] * rx + b[i];
                if (v == u) iters /= 2;
                for (int cnt = 0; cnt < iters; cnt++) {
                    add(v, u);
                }
            }
        }
    }
    if (ans.size() == n / 2) {
        cout << "Yes\n";
        for (auto& [i, j] : ans) {
            cout << i + 1 << " " << j + 1 << '\n';
        }
    } else {
        cout << "No\n";
    }
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
//    cin >> t;
    while (t--) {
        solve();
    }
}
