#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
#define PB push_back
#define MP make_pair
#define LL long long
#define int LL
#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
#define RE(i,n) FOR(i,1,n)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define R(i,n) REP(i,n)
#define VI vector<int>
#define PII pair<int,int>
#define LD long double
#define FI first
#define SE second
#define st FI
#define nd SE
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

#define unordered_map __fast_unordered_map
template<class Key, class Value, class Hash = std::hash<Key>>
using unordered_map = __gnu_pbds::gp_hash_table<Key, Value, Hash>;

template<class C> void mini(C &a4, C b4) { a4 = min(a4, b4); }
template<class C> void maxi(C &a4, C b4) { a4 = max(a4, b4); }

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;
  cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}

template<class T> ostream &operator<<(ostream& os, vector<T> V) {
  os << "["; for (auto vv : V) os << vv << ","; return os << "]";
}
template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
  return os << "(" << P.st << "," << P.nd << ")";
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif

vector<int> GetPermutation(int start_num, const VI &bits_enabled, const VI &bits_to_flip) {
  assert(SZ(bits_to_flip) % 2 == 1);
  if (SZ(bits_enabled) == 1) {
    return {start_num, start_num ^ (1 << bits_enabled[0])};
  }

  const int S = SZ(bits_to_flip);
  int flip_mid = bits_to_flip[0];
  VI flip1, flip2;
  if (S >= 3) {
    flip1.PB(bits_to_flip[1]);
    flip2 = VI(bits_to_flip.begin() + 2, bits_to_flip.end());
  } else {
    int x = -1;
    for (int i = 0; i < SZ(bits_enabled); ++i) {
      if (flip_mid == bits_enabled[i]) { continue; }
      x = bits_enabled[i];
      break;
    }
    assert(x != -1);
    flip1.PB(x);
    flip2.PB(x);
  }

  VI rem_enabled;
  for (int x : bits_enabled) {
    if (x != flip_mid) {
      rem_enabled.PB(x);
    }
  }

  auto first_perm = GetPermutation(start_num, rem_enabled, flip1);
  const int next_num = first_perm.back() ^ (1 << flip_mid);
  for (int x : GetPermutation(next_num, rem_enabled, flip2)) {
    first_perm.PB(x);
  }

  return first_perm;
}

int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(11);
  cerr << fixed << setprecision(6);

  int N, A, B;
  cin >> N >> A >> B;

  vector<int> bits_a, bits_b;
  for (int i = 0; i < N; ++i) {
    if ((A >> i) & 1) { bits_a.PB(i); }
    if ((B >> i) & 1) { bits_b.PB(i); }
  }

  if ((SZ(bits_a) + SZ(bits_b)) % 2 == 0) {
    cout << "NO\n";
    return 0;
  }

  vector<int> enabled(N);
  iota(ALL(enabled), 0);

  vector<int> to_flip;
  set_symmetric_difference(ALL(bits_a), ALL(bits_b), back_inserter(to_flip));

  auto ans = GetPermutation(A, enabled, to_flip);

  for (int i = 1; i < SZ(ans); ++i) {
    assert(__builtin_popcount(ans[i - 1] ^ ans[i]) == 1);
  }

  assert(ans[0] == A);
  assert(ans.back() == B);

  cout << "YES\n";
  for (int x : ans) { cout << x << " "; }
  cout << "\n";
}



Measured memory_bytes: 2736