// includes {{{
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<random>
#include<cassert>
#include<bitset>
#include<cstdlib>
// #include<deque>
// #include<multiset>
// #include<cstring>
// #include<bits/stdc++.h>
// }}}
using namespace std;
using ll = long long;

// #undef DEBUG
// #define DEBUG
// DEBUG {{{
#include <array>
#include <deque>
#include <list>
#include <ostream>
#include <queue>
#include <stack>
#include <tuple>
#include <valarray>
#include <vector>
template < int n, class... T >
typename std::enable_if< (n >= sizeof...(T)) >::type __output_tuple(
    std::ostream &, std::tuple< T... > const &) {}
template < int n, class... T >
typename std::enable_if< (n < sizeof...(T)) >::type __output_tuple(
    std::ostream &os, std::tuple< T... > const &t) {
  os << (n == 0 ? "" : ", ") << std::get< n >(t);
  __output_tuple< n + 1 >(os, t);
}
template < class... T >
std::ostream &operator<<(std::ostream &os, std::tuple< T... > const &t) {
  os << "(";
  __output_tuple< 0 >(os, t);
  os << ")";
  return os;
}
template < class T, class U >
std::ostream &operator<<(std::ostream &os, std::pair< T, U > const &p) {
  os << "(" << p.first << ", " << p.second << ")";
  return os;
}
template < class T >
std::ostream &operator<<(std::ostream &os, const std::stack< T > &a) {
  os << "{";
  for(auto tmp = a; tmp.size(); tmp.pop())
    os << (a.size() == tmp.size() ? "" : ", ") << tmp.top();
  os << "}";
  return os;
}
template < class T, class Container, class Compare >
std::ostream &operator<<(std::ostream &os,
    std::priority_queue< T, Container, Compare > a) {
  os << "{ (top) ";
  while(a.size()) os << a.top() << (a.size() == 1 ? "" : ", "), a.pop();
  os << " }";
  return os;
}
template < class T, class Container >
std::ostream &operator<<(std::ostream &os, std::queue< T, Container > a) {
  os << "{ ";
  while(a.size()) os << a.front() << (a.size() == 1 ? "" : ", "), a.pop();
  os << " }";
  return os;
}
#ifdef DEBUG
#if !defined(DEBUG_OUT)
// #define DEBUG_OUT std::cerr
#endif
#define dump(...)                                                                \
  [&]() {                                                                        \
    auto __debug_tap = std::make_tuple(__VA_ARGS__);                             \
    DEBUG_OUT << "[" << __LINE__ << "] " << #__VA_ARGS__ << " = " << __debug_tap \
    << std::endl;                                                      \
  }()
template < class T >
inline void dump2D(T &d, size_t sizey, size_t sizex) {
  for(size_t i = 0; i < sizey; i++) {
    DEBUG_OUT << "\t";
    for(size_t j = 0; j < sizex; j++)
      DEBUG_OUT << d[i][j] << (j + 1 == sizex ? "" : "\t");
    DEBUG_OUT << std::endl;
  }
}
template < class T >
inline void dump1D(T &d, size_t sizey) {
  for(size_t i = 0; i < sizey; i++) {
    DEBUG_OUT << d[i] << (i + 1 == sizey ? "" : " ");
  }
  DEBUG_OUT << std::endl;
}
template <
class T, class = typename std::iterator_traits< decltype(begin(T())) >::value_type,
      class = typename std::enable_if< !std::is_same< T, std::string >::value >::type >
      std::ostream &operator<<(std::ostream &os, const T &a) {
        os << "{";
        for(auto ite = begin(a); ite != end(a); ++ite)
          os << (ite == begin(a) ? "" : ", ") << *ite;
        os << "}";
        return os;
      }
#else
#define dump(...) (42)
#define dump2D(...) (42)
#define dump1D(...) (42)
template <
class T, class = typename std::iterator_traits< decltype(begin(T())) >::value_type,
      class = typename std::enable_if< !std::is_same< T, std::string >::value >::type >
      std::ostream &operator<<(std::ostream &os, const T &a) {
        for(auto ite = begin(a); ite != end(a); ++ite)
          os << (ite == begin(a) ? "" : " ") << *ite;
        return os;
      }
#endif
// }}}


int n;
ll a, b;

void NO() {
  cout << "NO" << endl;
  exit(0);
}

int popcount(int x) {
  x = (x & 0x55555555) + ((x & 0xAAAAAAAA) >> 1);
  x = (x & 0x33333333) + ((x & 0xCCCCCCCC) >> 2);
  x = (x & 0x0F0F0F0F) + ((x & 0xF0F0F0F0) >> 4);
  x = (x & 0x00FF00FF) + ((x & 0xFF00FF00) >> 8);
  x = (x & 0x0000FFFF) + ((x & 0xFFFF0000) >> 16);
  return x;
}

int op0(int e, int p) {
  int mask = (1 << (p - 1)) - 1;
  int mask2 = ~mask;
  return (
      (mask & e)
      ) | (
        (mask2 & e) << 1
        );
}
void op(int &e, int p) {
  e = op0(e, p);
}

vector<int> solve(int a, int b, int n) {
  b ^= a;
  vector<int> v;
  dump(n, b);
  if(n == 1) {
    if(b == 0) NO();
    v = {0, 1};
  }
  if(n == 2) {
    if(b == 0b01) v = {0, 2, 3, 1};
    else if(b == 0b10) v = {0, 1, 3, 2};
    else NO();
  }
  if(n >= 3) {
    int bc = popcount(b);
    dump(bc);
    if(bc == 0) {
      NO();
    } else if(bc == -1) {
      int bo = 0;
      for(int i = 0; i < n; i++) if(b & (1 << i)) bo = i;
      v = solve(0, (1 << (n - 1)) - 1, n - 1);
      auto w = v;
      dump(v);
      reverse(begin(w), end(w));
      for(auto &e : w) op(e, bo + 1);
      for(auto &e : w) e ^= 1 << bo;
      for(auto &e : v) op(e, bo + 1);
      v.insert(v.end(), w.begin(), w.end());
    } else if(bc == n) {
      if(n % 2 == 0) NO();
      v = solve(0, 1, n - 1);
      auto u = solve(1, (1 << (n - 1)) - 1, n - 1);
      dump(n, u);
      for(auto &e : u) e ^= 1 << (n - 1);
      // dump(u);
      // dump(v);
      v.insert(v.end(), u.begin(), u.end());
    } else {
      int re = n - bc;
      // dump(b, n, bc, re);
      auto w = solve(0, 1, re);
      for(int i = 0; i < n; i++) if((b & (1 << i))) {
        // dump(i);
        for(auto &e : w) op(e, i + 1);
      }
      auto u = solve(0, (1 << bc) - 1, bc);
      for(int i = 0; i < n; i++) if(!(b & (1 << i))) for(auto &e : u) op(e, i + 1);
      auto wrev = w;
      reverse(wrev.begin(), wrev.end());
      dump(w);
      dump(u);

      int c = 0;
      for(auto e1 : u) {
        c ^= 1;
        auto &x = c ? w : wrev;
        for(auto e2 : x) {
          v.push_back(e1 ^ e2);
        }
      }
    }
  }

  dump(v);
  for(auto &e : v) e ^= a;
  return v;
}

int main() {
  std::ios::sync_with_stdio(false), std::cin.tie(0);
  cin >> n;
  cin >> a >> b;
  // dump(solve(0, (1 << 3) - 1, 3));
  // dump(solve(1, (1 << 4) - 1, 4));
  // dump(solve(0, (1 << 5) - 1, 5));
  auto v = solve(a, b, n);
  // dump(bitset<10>(op0(0b0110101, 3)));
  cout << "YES" << endl;
  for(int i = 0; i < 1 << n; i++) cout << v[i] << " \n"[i == (1 << n) - 1];
  // assert(v.size() == (1 << n));
  return 0;
}


Measured memory_bytes: 1804