#include <bits/stdc++.h>
using namespace std;

using i64 = int64_t;

#define rep(i, x, y) for (i64 i = i64(x), i##_max_for_repmacro = i64(y); i < i##_max_for_repmacro; ++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf = 1.01e9;
const i64 inf64 = 4.01e18;
const double eps = 1e-9;

template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "(" << p.first << ", " << p.second << ")";
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "[";
    for (const auto &v : vec) {
        os << v << ",";
    }
    os << "]";
    return os;
}

template <typename T>
bool chmin(T &a, const T &b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

void solve() {
    //const i64 mod = 1'000'000'007;

    i64 N,A,B;
    cin >> N >> A >> B;

    const i64 maxn=17;
    vector<i64> diff;
    rep(i,0,N){
        i64 k=1<<i;
        if((A&k)!=(B&k)){
            diff.emplace_back(i);
        }
    }

    if(diff.size()%2!=1){
        cout << "NO" << endl;
        return;
    }

    vector<i64> ans(1<<N),eo(N),use(N),org;
    for(auto d:diff){
        eo[d]=1;
    }

    org=eo;

    static bool visit[1<<maxn];
    fill_n((bool*)visit,1<<maxn,false);

    vector<i64> js(N);
    rep(i,0,N){
        js[i]=i;
    }

    vector<i64> deg(1<<N,N);

    function<bool(i64,i64)> dfs=[&](i64 i,i64 pos){
        ans[i]=pos;
        visit[pos]=true;

        if(i==((1<<N)-1)){
            assert(pos==B);
            return true;
        }

        rep(j,0,N) {
            i64 np = pos ^(1 << j);
            if (visit[np]) continue;
            --deg[np];
        }

        i64 deg1=-1;
        bool ok=true;
        rep(j,0,N){
            i64 np = pos ^(1 << j);
            if (visit[np]) continue;

            if(deg[np]==0){
                if(i+1==((1<<N)-1) and np==B) continue;
                ok=false;
                break;
            } else if(deg[np]==1){
                if(np==B and i+1!=((1<<N)-1)){
                    continue;
                }
                if(deg1==-1){
                    deg1=np;
                    continue;
                }
                ok=false;
                break;
            }
        }

        if(!ok){
            rep(j,0,N) {
                i64 np = pos ^(1 << j);
                if (visit[np]) continue;
                ++deg[np];
            }
            visit[pos]=false;
            return false;
        }

        if(deg1!=-1){
            auto res=dfs(i+1,deg1);
            rep(j,0,N) {
                i64 np = pos ^(1 << j);
                if (visit[np]) continue;
                ++deg[np];
            }
            visit[pos]=false;
            return res;
        }

        for(auto j:js){
            i64 np=pos^(1<<j);
            if(visit[np]) continue;
            if(np==B and (i+1!=((1<<N)-1))) continue;

            if(dfs(i+1,pos^(1<<j))) return true;
        }

        rep(j,0,N) {
            i64 np = pos ^(1 << j);
            if (visit[np]) continue;
            ++deg[np];
        }

        visit[pos]=false;
        return false;
    };

    if(!dfs(0,A)){
        cout << "NO" << endl;
        return;
    }

    cout << "YES" << endl;
    rep(i,0,1<<N){
        cout << ans[i];
        if(i==((1<<N)-1)) cout << endl;
        else cout << " ";
    }
}

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}


Measured memory_bytes: 15488