//~ while (clock()<=69*CLOCKS_PER_SEC)
//~ #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
//~ #pragma GCC optimize("Ofast")
//~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//~ #pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace __gnu_pbds;
using namespace std;
 
template <typename T>
using ordered_set =
	tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
 
#define shandom_ruffle random_shuffle
 
using ll=long long;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using vi=vector<int>;
using vll=vector<ll>;
const int nax=1000*1007;
const ll mod=1000*1000*1000+7;
 
int n;

int usun(int v, int kt)
{
	int x=((v>>(kt+1))<<kt)^(v&((1<<kt)-1));
	return x;
}

int wstaw(int v, int kt, int b)
{
	int x=((v>>kt)<<(kt+1))^(v&((1<<kt)-1))^(b<<kt);
	return x;
}

vi rek(int k, int a, int b)
{
	//~ debug() << k << " " << a << " " << b;
	if (k==1)
		return {a, b};
	int m=(1<<k);
	int x=a^b;
	if (__builtin_popcount(x)==1)
	{
		for (int i=0; i<k; i++)
		{
			if (!(x&(1<<i)))
			{
				//~ debug() << k << " chce " << i;
				vi wez=rek(k-1, usun(a, i), usun(b, i));
				//~ debug() << wez;
				//~ for (int j : wez)
					//~ debug() << j << " " << wstaw(j, i, 1) << " " << wstaw(j, i, 0);
				vi ret;
				for (int j=0; j<m/2; j++)
				{
					if (!(j&1))
					{
						ret.push_back(wstaw(wez[j], i, (a>>i)&1));
						ret.push_back(wstaw(wez[j], i, ((a>>i)&1)^1));
					}
					else
					{
						ret.push_back(wstaw(wez[j], i, ((a>>i)&1)^1));
						ret.push_back(wstaw(wez[j], i, (a>>i)&1));
					}
				}
				return ret;
			}
		}
		
		assert(0);
	}
	vi roz;
	for (int i=0; i<k; i++)
		if (x&(1<<i))
			roz.push_back(i);
	x=roz[0];
	int y=roz[1];
	int z=roz[2];
	
	int na=usun(a, z);
	int nb=usun(b, z);
	
	vi raz=rek(k-1, na, na^(1<<x));
	vi dwa=rek(k-1, na^(1<<x), nb);
	//~ debug() << raz << " " << dwa;
	
	vi ret;
	for (int i : raz)
		ret.push_back(wstaw(i, z, (a>>z)&1));
	for (int i : dwa)
		ret.push_back(wstaw(i, z, (b>>z)&1));
	
	return ret;
}
 
int main()
{
	scanf("%d", &n);
	int a, b;
	scanf("%d%d", &a, &b);
	if ((__builtin_popcount(a^b)&1)==0)
	{
		printf("NO\n");
		return 0;
	}
	vi wez=rek(n, a, b);
	printf("YES\n");
	for (int i : wez)
		printf("%d ", i);
	printf("\n");
	
	assert(wez[0]==a);
	assert(wez.back()==b);
	for (int i=1; i<(int)wez.size(); i++)
		assert(__builtin_popcount(wez[i]^wez[i-1])==1);
	return 0;
}


Measured memory_bytes: 1708