#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < int(n); i++)
#define rep1(i,n) for (int i = 1; i <= int(n); i++)
#define repR(i,n) for (int i = int(n)-1; i >= 0; i--)
#define rep1R(i,n) for (int i = int(n); i >= 1; i--)
#define loop(i,a,B) for (int i = a; i B; i++)
#define loopR(i,a,B) for (int i = a; i B; i--)
#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define fst first
#define snd second
#define cauto const auto
#ifdef LOCAL
#define dump(...) cerr << "[" << __LINE__ << ":" << __FUNCTION__ << "] ", my_dmp(#__VA_ARGS__, __VA_ARGS__)
void my_dmp(const char*) { cerr << endl; }
template <class T, class... U>
void my_dmp(const char *s, T const& x, U const& ...y) { const char *o = "({[", *e = "]})"; for (int i = 0; *s != '\0'; cerr << *s++) { if (count(o,o+3,*s)) i++; if (count(e,e+3,*s)) i--; if (!i && *s == ',') break; } cerr << " = " << x; if (*s == ',') cerr << ", ", s++; my_dmp(s, y...); }
#else
#define dump(...)
#endif
using ll = long long;
#define int ll
template <class T> using pque_max = priority_queue<T>;
template <class T> using pque_min = priority_queue<T, vector<T>, greater<T> >;
#define CONAINER_OUTPUT os << "{"; for (auto const& x : v) os << " " << x; return os << " }";
template <class T> ostream& operator<<(ostream& os, vector<T> const& v) { CONAINER_OUTPUT }
template <class T> ostream& operator<<(ostream& os, deque<T> const& v) { CONAINER_OUTPUT }
template <class T> ostream& operator<<(ostream& os, set<T> const& v) { CONAINER_OUTPUT }
template <class T> ostream& operator<<(ostream& os, multiset<T> const& v) { CONAINER_OUTPUT }
template <class T, class U> ostream& operator<<(ostream& os, map<T,U> const& v) { CONAINER_OUTPUT }
#undef CONAINER_OUTPUT
template <class T> istream& operator>>(istream& is, vector<T>& v) { for (auto& x : v) is >> x; return is; }
template <class T, class S> ostream& operator<<(ostream& os, pair<T,S> const& p) { return os << "(" << p.first << ", " << p.second << ")"; }
template <class T, class S> istream& operator>>(istream& is, pair<T,S>& p) { return is >> p.first >> p.second; }
struct my_Init { my_Init() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); } } my_init;

template <class T> void quit(T const& x) { cout << x << endl; exit(0); }
template <class T> bool chmin(T& x, T const& y) { if (x > y) { x = y; return true; } return false; }
template <class T> bool chmax(T& x, T const& y) { if (x < y) { x = y; return true; } return false; }
template <class It> auto sumof(It b, It e) { return accumulate(b,e,typename iterator_traits<It>::value_type{}); }
////////////////////////////////
#define ppcnt __builtin_popcount

int en(int n, int i, int x) {
    int mask0 = ((1<<(n-i))-1)<<i;
    int mask1 = ((1<<(n-i-1))-1)<<(i+1);
    return (x&~mask0) | ((x&mask1)>>1) | ((x>>i&1)<<(n-1));
}

int de(int n, int i, int x) {
    int mask0 = ((1<<(n-i))-1)<<i;
    int mask1 = ((1<<(n-i-1))-1)<<i;
    return (x&~mask0) | ((x&mask1)<<1) | ((x>>(n-1)&1)<<i);
}

vector<int> rec(int n, int a, int b) {
    dump(n,a,b);
    if (n == 1) return { a, b };
    int ii = -1;
    rep (i,n) if ((a>>i&1) != (b>>i&1)) ii = i;
    assert(ii != -1);
    vector<int> v; v.reserve(1<<n);
    int jj = 0; if (ii == jj) jj++;

    auto v1 = rec(n-1, en(n,ii,a), en(n,ii,a^(1<<jj)));
    auto v2 = rec(n-1, en(n,ii,a^(1<<ii)^(1<<jj)), en(n,ii,b));
    for (int &x : v1) x = de(n,ii,x);
    for (int &x : v2) x = de(n,ii,x);
    v1.reserve(v1.size()+v2.size());
    copy(all(v2),back_inserter(v1));
    dump(n,a,b,v1);
    return v1;
}

string to_bit(int x, int size = 18) {
    string s;
    repR (i,size) s.push_back( char((x>>i&1LL)+'0') );
    return s;
}

int32_t main() {
    int n,a,b;
    cin >> n >> a >> b;

    if ((ppcnt(a)-ppcnt(b))%2 == 0) quit("NO");
    cout << "YES\n";

    auto v = rec(n,a,b);
    for (int x : v) cout << x << " ";
    cout << "\n";
//    for (int x : v) cout << to_bit(x) << endl;

    // assert(v.front() == a && v.back() == b);
    // rep (i,v.size()-1) assert(ppcnt(v[i]^v[i+1])==1);
    // sort(all(v));
    // rep (i,v.size()) assert(v[i]==i);
    
}


Measured memory_bytes: 2900