#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
using namespace std;
using Graph=vector<vector<int>>;
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T>inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

////////// グレイコード //////////

ll encode(ll n){
  return n^(n>>1);
}
unsigned long long int decode(ll n){
  unsigned long long int b=pow(2,17);
  unsigned long long int m=b&n;
  while(b!=0){
    unsigned long long int c=(b&m)>>1;
    b>>=1;
    m|=c^(n&b);
  }
  return m;
}

//////////////////////////////////////////////////

int main(){
  ll N,A,B;
  cin>>N>>A>>B;
  
  ll L[1<<N];
  for(ll i=0; i<pow(2,N-1); i++){
    ll E=encode(i);
    L[i]=E;
  }
  
  bool CAN=false;
  ll C=B^A,D=C,cnt=0;
  while(C>0){
    if(C%2==1){
      C--;
      cnt++;
    }
    C/=2;
  }
  if(cnt%2==0) CAN=true;
  
  if(CAN){
    CONO;
    return 0;
  }
  
  COYE;
  ll ANS[1<<N],t=1;
  ANS[0]=0;
  
  for(ll i=1; i<pow(2,N); ++i){
    if(i%4==1) ANS[i]=ANS[i-1]+pow(2,N-1);
    else if(i%4==3) ANS[i]=ANS[i-1]-pow(2,N-1);
    else  ANS[i]=ANS[i-1]+L[i/2]-L[i/2-1];
    
    if(ANS[i]==D){
      t=i;
      break;
    }
  }
  
  if(t%4==1){
    for(ll i=t; i<(pow(2,N)+t)/2; ++i) ANS[i]=L[i-t/2];
    for(ll i=(pow(2,N)+t)/2; i<pow(2,N); ++i) ANS[i]=pow(2,N-1)+L[(1<<(N-1))-1-(i-((1<<N)+t)/2)];
  }
  else{
    for(ll i=t; i<(pow(2,N)+t)/2; ++i) ANS[i]=pow(2,N-1)+L[i-t/2];
    for(ll i=(pow(2,N)+t)/2; i<pow(2,N); ++i) ANS[i]=L[(1<<(N-1))-1-(i-((1<<N)+t)/2)];
  }
  
  for(ll i=0; i<pow(2,N); ++i){
    cout<<(ANS[i]^A);
    cout<<" ";
  }
  cout<<endl;
  return 0;
}

Measured memory_bytes: 2560