#include <iostream>
#include <cassert>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
#include <tuple>

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P;

long long int INF = 3e18;
double Pi = 3.1415926535897932384626;

vector<ll> G[500005];
vector<P> tree[500010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop

int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//ll bit[500005];
//↓,→,↑,←


#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<(x)<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pd(x) cerr<<"//"<<(x)<<endl;
#define re(i,n) for(i=0;i<n;i++);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define deba(x) cout<< #x << " = " << x <<endl


ll mod = 1000000007;
ll rui(ll number1,ll number2){
    if(number2 == 0){
        return 1;
    }else{
        ll number3 = rui(number1,number2 / 2);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
ll gcd(ll number1,ll number2){
    if(number1 > number2){
        swap(number1,number2);
    }
    if(number1 == 0 || number1 == number2){
        return number2;
    }else{
        return gcd(number2 % number1,number1);
    }
}
void YES(bool condition){
    if(condition){
        p("YES");
    }else{
        p("NO");
    }
    return;
}
void Yes(bool condition){
    if(condition){
        p("Yes");
    }else{
        p("No");
    }
    return;
}

ll n,m,num,sum,ans,a,b,c,d,e,f,g,h,i,j,k,w,ok,ng,l,q;
ll x[500005],y[500005],z[500005];
bool dp[20][500005],sub[20][500005];
bool use[500005],used[500005];
char s[500005],t[500005];
bool flag,dame;


void solve(ll nu){
	//p(nu);
	if(nu == 1){
		x[0] = 0;
		return;
	}
	solve(nu-1);
	for(ll i=0;i<(1ll<<nu)-1;i++){
		if(i % 2 == 0){
			y[i] = nu - 1;
		}else{
			y[i] = x[i/2];
		}
	}
	for(i=0;i<(1ll<<nu)-1;i++){
		x[i] = y[i];
	}
}

	




int main(){
    cin >> n >> a >> b;
	b = (b ^ a);
	solve(n);
	for(i=0;i<(1ll<<n)-1;i++){
		//pe(x[i]);
	}
	//el;
	for(i=0;i<60;i++){
		if(b & (1ll << i))d++;
	}
	if(d % 2 == 0){
		YES(0);
		return 0;
	}
	YES(1);
	num = 0;
	for(i=0;i<n;i++)dp[i][0] = 0;
	z[0] = 0;
	for(i=0;i<(1ll<<n)-1;i++){
		if(!use[x[i]]){
			use[x[i]] = true;
			num ++;
		}else{
			use[x[i]] = false;
			num --;
		}
		for(j=0;j<n;j++){
			if(use[j]){
				dp[j][i+1] = 1;
			}else{
				dp[j][i+1] = 0;
			}
		}
		z[i+1] = num;
	}
	e = z[(1ll<<n) - 1];
	for(i=0;i<(1ll<<n);i++){
		for(j=0;j<n;j++){
			//pe(dp[j][i]);
		}
		//el;
	}
	while(d != e){
		pd(e);
		flag = false;
		if(d > e){
			for(i=0;i<(1ll<<n)-1;i++){
				f = 0;
				if(z[i] != e + 1 || z[i+1] != e + 2)continue;
				for(j=0;j<n;j++){
					if(dp[j][i] && !dp[j][(1ll<<n)-1])f++;
					if(!dp[j][i] && dp[j][(1ll<<n)-1])f++;
					if(f > 1)break;
				}
				if(z[i] == e + 1 && z[i+1] == e + 2 && f == 1){
					for(j=i+1;j<(1ll<<n);j++){
						for(k=0;k<n;k++){
							sub[k][j] = dp[k][j];
						}
					}
					for(j=i+1;j<(1ll<<n);j++){
						for(k=0;k<n;k++){
							dp[k][j] = sub[k][i-j+(1ll<<n)];
						}
					}
					flag = true;
					break;
				}
			}
			if(!flag){
				for(i=0;i<(1ll<<n)-1;i++){
					f = 0;
					if(!dame && z[i+1] != e)continue;
					for(j=0;j<n;j++){
						if(dp[j][i] && !dp[j][(1ll<<n)-1])f++;
						if(!dp[j][i] && dp[j][(1ll<<n)-1])f++;
						if(f > 1)break;
					}
					if(f == 1){
						if(g == i)dame = true;
						else dame = false;
						g = i;
						for(j=i+1;j<(1ll<<n);j++){
							for(k=0;k<n;k++){
								sub[k][j] = dp[k][j];
							}
						}
						for(j=i+1;j<(1ll<<n);j++){
							for(k=0;k<n;k++){
								dp[k][j] = sub[k][i-j+(1ll<<n)];
							}
						}
						flag = true;
						break;
					}
				}
			}
		}else{
			for(i=0;i<(1ll<<n)-1;i++){
				f = 0;
				if(z[i] != e - 1 || z[i+1] != e - 2)continue;
				for(j=0;j<n;j++){
					if(dp[j][i] && !dp[j][(1<<n)-1])f++;
					if(!dp[j][i] && dp[j][(1<<n)-1])f++;
					if(f > 1)break;
				}
				if(z[i] == e - 1 && z[i+1] == e - 2 && f == 1){
					for(j=i+1;j<(1ll<<n);j++){
						for(k=0;k<n;k++){
							sub[k][j] = dp[k][j];
						}
					}
					for(j=i+1;j<(1ll<<n);j++){
						for(k=0;k<n;k++){
							dp[k][j] = sub[k][i-j+(1ll<<n)];
						}
					}					
					flag = true;
					break;
				}
			}
			if(!flag){
				for(i=0;i<(1ll<<n)-1;i++){
					f = 0;
					if(!dame && z[i+1] != e)continue;
					for(j=0;j<n;j++){
						if(dp[j][i] && !dp[j][(1<<n)-1])f++;
						if(!dp[j][i] && dp[j][(1<<n)-1])f++;
						if(f > 1)break;
					}
					if(f == 1){
						if(g == i)dame = true;
						else dame = false;
						g = i;
						for(j=i+1;j<(1ll<<n);j++){
							for(k=0;k<n;k++){
								sub[k][j] = dp[k][j];
							}
						}
						for(j=i+1;j<(1ll<<n);j++){
							for(k=0;k<n;k++){
								dp[k][j] = sub[k][i-j+(1ll<<n)];
							}
						}
						flag = true;
						break;
					}
				}
			}
		}
		for(i=0;i<(1ll<<n);i++){
			f = 0;
			for(j=0;j<n;j++){
				if(dp[j][i])f++;
			}
			z[i] = f;
		}
		for(i=0;i<(1ll<<n);i++){
			if(i < (1ll << n) - 1){
				assert(abs(z[i] - z[i+1]) == 1);
			}
		}
		assert(flag);
		e = f;
	}
	f = n-1;
	e = 0;
	for(i=0;i<n;i++){
		if((1ll << i) & b){
			y[e++] = i;
		}else{
			y[f--] = i;
		}
	}
	e = 0;f=n-1;
	for(i=0;i<n;i++){
		if(dp[i][(1ll<<n)-1]){
			z[i] = e++;
		}else{
			z[i] = f--;
		}
	}

	for(i=0;i<(1ll<<n);i++){
		for(j=0;j<n;j++){
			if(dp[j][i]){
				sub[y[z[j]]][i] = 1;
			}else{
				sub[y[z[j]]][i] = 0;
			}
		}
	}
	for(i=0;i<(1ll<<n);i++){
		f = 0;
		for(j=0;j<n;j++){
			//pe(sub[j][i]);
			if(sub[j][i])f += (1ll << j);
		}
		//el;
		if(used[f ^ a]){
			assert(0);
		}
		x[i] = (f ^ a);
		used[f ^ a] = true;
	}
	for(i=0;i<(1<<n);i++){
		pe(x[i]);
	}
	assert(x[0] == a);

	el;
	return 0;
}

Measured memory_bytes: 49664