#include<cstdio>
#include<cstring>
#include<algorithm>
#ifndef FOR
	#define FOR(i, a, b)  for(int i(a), i##_END_(b); i < i##_END_; i++)
	#define ROF(i, a, b)  for(int i(a), i##_BEG_(b); i > i##_BEG_; i--)
	#define FOR_(i, a, b) for(int i(a); i < (b); i++)
	#define ROF_(i, a, b) for(int i(a); i > (b); i--)
#endif
#define return_with(...) return (void) (__VA_ARGS__)
#define continue_with(...) {__VA_ARGS__; continue;}
#define break_with(...) {__VA_ARGS__; break;}
template<typename T, typename _> inline bool Max(T &x, _ y) {return x < y ? x = y, true : false;}
template<typename T, typename _> inline bool Min(T &x, _ y) {return x > y ? x = y, true : false;}
template<typename T> inline void Rd(T &x) {
	static char c; x = 0;
	while(c = getchar(), c < 48);
	do x = (x<<1) + (x<<3) + (c^48);
	while(c = getchar(), c > 47);
}
#define M 131131
#define N 17
int tmp[M], len = 1;
int ans[M][N];
int number[M];
int bbit[N];
int real[M];
int sn[M][2], sz[M], fa[M], rt;
bool laz[M];
inline int dotira(int x) {return sn[fa[x]][1] == x;}
inline void Up(int x) {sz[x] = sz[sn[x][0]] + sz[sn[x][1]] + 1;}
inline void Down(int x) {
	if(!laz[x]) return;
	std::swap(sn[x][0], sn[x][1]);
	if(sn[x][0]) laz[sn[x][0]] ^= 1;
	if(sn[x][1]) laz[sn[x][1]] ^= 1;
	laz[x] = false;
}
inline void rotate(int x) {
	int cur = dotira(x), f = fa[x], &xsn = sn[x][cur ^ 1], oji = fa[f];
	if((fa[x] = oji)) sn[oji][dotira(f)] = x;
	if((sn[f][cur] = xsn)) fa[xsn] = f;
	fa[xsn = f] = x;
	Up(f), Up(x);
}
void splay(int x, int goal) {
	int f;
	while((f = fa[x]) != goal) {
		Down(fa[f]), Down(f), Down(x);
		if(fa[f] != goal) {
			if(dotira(x) == dotira(f)) rotate(f);
			else rotate(x);
		}
		rotate(x);
	}
	if(!goal) rt = x;
}
int tonari(int x, int cur) {
	splay(x, 0);
	x = sn[x][cur];
	while(Down(x), sn[x][cur ^ 1]) x = sn[x][cur ^ 1];
	return x;
}
inline int findkth(int k) {
	int x = rt, totsz;
findst:
	Down(x);
	totsz = sz[sn[x][0]] + 1;
	if(k > totsz) x = sn[x][1], k -= totsz;
	else if(k <= sz[sn[x][0]]) x = sn[x][0];
	else return x;
	goto findst;
}
int split(int x, int y) {
	splay(x, 0), splay(y, x);
	int p = sn[y][0];
	sn[y][0] = 0;
	fa[p] = 0;
	Up(y), Up(x);
	return p;
}
inline void New(int x, int cur, int p) {
	int f = tonari(x, cur);
	splay(x, 0);
	if(f) splay(f, x), sn[f][cur ^ 1] = p, Up(f), Up(x);
	else if(x) sn[f = x][cur] = p, Up(x);
	fa[p] = f;
	splay(p, 0);
}
int main() {
	int n, a, b;
	Rd(n), Rd(a), Rd(b);
	int m = 1 << n;
	for(int i = 1; i < m; i++) {
		if(i == len) {
			for(int ii = 1; ii <= i; ii++) tmp[ii + i] = tmp[ii];
			tmp[len <<= 1]++;
		}
		for(int j = 0; j < n; j++) ans[i][j] = ans[i - 1][j];
		ans[i][tmp[i]] ^= 1;
		number[i] = number[i - 1] ^ (1 << tmp[i]);
	}
	int cntb = 0; b ^= a;
	for(int i = 0; i < n; i++) cntb += (bbit[i] = bool(b & (1 << i)));
	if(cntb & 1) {
		puts("YES");
		for(int i = 1; i <= m + 2; i++) {
			sz[i] = fa[i] = 0;
			sn[i][0] = sn[i][1] = 0;
			laz[i] = false;
		}
		sz[1] = 1;
		for(int i = 2; i <= m + 2; i++) {
			sn[i][0] = i - 1;
			fa[i - 1] = i;
			Up(i);
		}
		rt = m + 2;
		for(int xx = m; xx; xx -= 2) {
			int x = findkth(xx);
			int p = split(x, m + 2);
			laz[p] ^= 1, New(x, 1, p);
			int now = findkth(m + 1) - 2;
			bool flag = 1;
			for(int i = 0; i < n; i++) flag &= (ans[now][i] == bbit[i]);
			if(flag) {
				int now = findkth(2);
				for(int i = 0; i < m; i++) printf("%d ", number[now - 2] ^ a), now = tonari(now, 1);
				putchar(10);
				break;
			}
		}
	} else puts("NO");
	return 0;
}

Measured memory_bytes: 13312