#include <bits/stdc++.h>

using namespace std;

using ll = long long;

vector<int> gray_code(int n) {
    vector<int> res;
    if (n == 1) {
        res = {0, 1};
        return res;
    }

    vector<int> codes = gray_code(n - 1);
    res = codes;
    reverse(codes.begin(), codes.end());
    for (int x : codes) {
        res.push_back((1 << (n - 1)) + x);
    }
    return res;
}

bool check1(int n, int a, int b, vector<int>& ans) {
    if (ans.front() != a || ans.back() != b) return false;
    for (int i = 0; i + 1 < ans.size(); i++) {
        if (__builtin_popcount(ans[i] ^ ans[i + 1]) != 1) return false;
    }
    return true;
}

bool check2(int n, int a, int b) {
    vector<int> codes;
    for (int i = 0; i < (1 << n); i++) codes.push_back(i);
    do {
        if (codes.front() != a || codes.back() != b) {
            continue;
        }
        bool f = true;
        for (int i = 0; i + 1 < codes.size(); i++) {
            if (__builtin_popcount(codes[i] ^ codes[i + 1]) != 1) {
                f = false;
                break;
            }
        }
        if (f) {
            for (int i = 0; i < codes.size(); i++) {
                cerr << codes[i] << " \n"[i + 1 == codes.size()];
            }
            return true;
        }
    } while (next_permutation(codes.begin(), codes.end()));
    return false;
}

vector<int> solve(int n, int a, int b) {
    if (a != 0) {
        vector<int> res = solve(n, 0, a ^ b);
        for (int& x : res) x ^= a;
        return res;
    }
    if (n == 1) {
        return {0, 1};
    }

    int idx = 0;
    while ((b & (1 << idx)) == 0) {
        idx++;
    }

    int tar = b;
    tar = ((tar >> (idx + 1)) << idx);
    //cerr << n << "," << tar << "," << idx << endl;

    if (tar == 0) {
        vector<int> res;
        vector<int> codes = gray_code(n - 1);
        res = codes;
        for (int& x : res) {
            int foo = (x & ((1 << idx) - 1));
            int bar = ((x >> idx) << (idx + 1));
            x = foo + bar;            
        }
        reverse(codes.begin(), codes.end());
        for (int x : codes) {
            int foo = (x & ((1 << idx) - 1));
            int bar = ((x >> idx) << (idx + 1));
            x = foo + bar + (1 << idx);   
            res.push_back(x);
        }
        return res;
    }

    int idx2 = 0;
    while ((tar & (1 << idx2)) == 0) {
        idx2++;
    }

    vector<int> v1 = solve(n - 1, 0, (1 << idx2));
    vector<int> v2 = solve(n - 1, (1 << idx2), tar);

    vector<int> res;
    for (int x : v1) {
        int foo = (x & ((1 << idx) - 1));
        int bar = ((x >> idx) << (idx + 1));
        x = foo + bar;  
        res.push_back(x);      
    }

    for (int x : v2) {
        int foo = (x & ((1 << idx) - 1));
        int bar = ((x >> idx) << (idx + 1));
        x = foo + bar + (1 << idx);      
        res.push_back(x); 
    }
    return res;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, a, b;
    cin >> n >> a >> b;

    if (n == 1) {
        cout << "YES" << endl;
        cout << a << " " << b << endl;
        return 0;
    }

    if (__builtin_popcount(a ^ b) % 2 == 0) {
        cout << "NO" << endl;
        return 0;
    }

    vector<int> ans = solve(n, a, b);
    cout << "YES" << endl;
    for (int i = 0; i < ans.size(); i++) {
        cout << ans[i] << " \n"[i + 1 == ans.size()];
    }
    return 0;
}

Measured memory_bytes: 1648