// Dmitry _kun_ Sayutin (2019)

#include <bits/stdc++.h>

using std::cin;
using std::cout;
using std::cerr;

using std::vector;
using std::map;
using std::array;
using std::set;
using std::string;

using std::pair;
using std::make_pair;

using std::tuple;
using std::make_tuple;
using std::get;

using std::min;
using std::abs;
using std::max;
using std::swap;

using std::unique;
using std::sort;
using std::generate;
using std::reverse;
using std::min_element;
using std::max_element;

#ifdef LOCAL
#define LASSERT(X) assert(X)
#else
#define LASSERT(X) {}
#endif

template <typename T>
T input() {
    T res;
    cin >> res;
    LASSERT(cin);
    return res;
}

template <typename IT>
void input_seq(IT b, IT e) {
    std::generate(b, e, input<typename std::remove_reference<decltype(*b)>::type>);
}

#define SZ(vec)         int((vec).size())
#define ALL(data)       data.begin(),data.end()
#define RALL(data)      data.rbegin(),data.rend()
#define TYPEMAX(type)   std::numeric_limits<type>::max()
#define TYPEMIN(type)   std::numeric_limits<type>::min()

int n;

vector<int> solve(int mask, int end) {
    assert((end & (~mask)) == 0);
    
    if (__builtin_popcount(mask) == 1) {
        return vector<int> {0, end};
    } else {
        int bt = 0;
        while ((end & (1 << bt)) == 0)
            ++bt;

        end ^= (1 << bt);
        mask ^= (1 << bt);
        
        for (int elem = mask; elem != 0; elem = (elem - 1) & mask) {
            if (__builtin_popcount(elem) % 2 == 0)
                continue;
            if (__builtin_popcount(end ^ elem) % 2 == 0)
                continue;
            
            if (elem != end) {
                vector<int> ch1 = solve(mask, elem);
                vector<int> ch2 = solve(mask, end ^ elem);

                vector<int> res;
                for (int el: ch1)
                    res.push_back(el);

                std::reverse(ALL(ch2));
                for (int el: ch2)
                    res.push_back(el ^ end ^ (1 << bt));

                return res;
            }
        }

        assert(false);
    }
}

void verify(int n, int a, int b, vector<int> ans) {
    assert(SZ(ans) == (1 << n));
    assert(ans[0] == a);
    assert(ans.back() == b);

    for (int i = 1; i != SZ(ans); ++i)
        assert((__builtin_popcount(ans[i - 1] xor ans[i])) == 1);

    vector<char> used(1 << n, 0);
    for (int el: ans) {
        assert(0 <= el and el < (1 << n));

        assert(not used[el]);
        used[el] = 1;
    }
}

int main() {
    std::iostream::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    // code here
#if 0
    for (int n = 1; n <= 4; ++n) {
        cout << "Running " << n << std::endl;

        for (int i = 1; i != (1 << n); ++i)
            if (__builtin_popcount(i) % 2 == 1) {
                cout << i << std::endl;
                vector<int> res = solve((1 << n) - 1, i);
                cout << "OK" << std::endl;
            }
    }
#endif
    
    n = input<int>();
    int a = input<int>();

    int b = input<int>();

    if (__builtin_popcount(a xor b) % 2 != 1)
        cout << "NO\n";
    else {
        cout << "YES\n";

        vector<int> ans = solve((1 << n) - 1, a xor b);

        for (int& elem: ans)
            elem ^= a;

        for (int i = 0; i != SZ(ans); ++i)
            cout << ans[i] << " \n"[i + 1 == SZ(ans)];

        cout.flush();
        verify(n, a, b, ans);
    }
    
    return 0;
}



Measured memory_bytes: 2268