#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <chrono>
#include <bitset>
using namespace std;

//タイマー
class Timer
{
	chrono::high_resolution_clock::time_point start, end;
	double limit;

public:
	Timer()
	{
		start = chrono::high_resolution_clock::now();
	}
	Timer(double l)
	{
		start = chrono::high_resolution_clock::now();
		limit = l;
	}

	double getTime()
	{
		end = chrono::high_resolution_clock::now();
		return chrono::duration<double>(end - start).count();
	}

	bool Over()
	{
		if (getTime() > limit)
		{
			return true;
		}
		return false;
	}

	void setLimit(double l)
	{
		limit = l;
	}
	void setStart() { start = chrono::high_resolution_clock::now(); }
	double getLimit() { return limit; }
};

//疑似乱数
class XorShift
{
	unsigned int x, y, z, w;
public:
	XorShift()
	{
		x = 31103110, y = 123456789, z = 521288629, w = 88675123;
	}

	unsigned int nextInt()
	{
		unsigned int t;
		t = (x ^ (x << 11)); x = y; y = z; z = w;
		return(w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
	}
};
XorShift rnd;

typedef long long ll;

bool find2(int N, int A, int B)
{
	vector<char>used(1 << N);
	used[A] = true;

	vector<bitset<17>>order;
	order.push_back(A);

	vector<int>changed(N);

	int dame = 0;
	int cnt = 1;
	int bit = 0;
	for (int i = 0; i < N; i++)if (A&(1 << i))bit++;

	while (A != B)
	{
		int r = rnd.nextInt() % N;
		//if (cnt == (1 << (N - 1)))r = 0;

		//int nbit = 0;
		//if (A&(1 << r))nbit = bit-1;
		//else nbit = bit+1;

		int b = A ^ (1 << r);

		if (used[b] || (cnt != (1 << N) - 1 && b == B))
		{
			dame++;
			if (dame > 3 * N)break;
			continue;
		}

		changed[r]++;
		for (int i = 0; i < N; i++)
		{
			cerr << i << " " << changed[i] << endl;
		}cerr << endl;

		//if (A&(1 << r))bit--;
		//else bit++;
		//cerr<<cnt<<" "<<bit<<endl;

		A = b;
		used[A] = true;
		cnt++;
		dame = 0;
		order.push_back(A);
	}

	if (dame <= 3 * N)
	{
		for (int i = 0; i < N; i++)
		{
			cerr << i << " " << changed[i] << endl;
		}
		for (int i = 0; i < order.size(); i++)
		{
			cerr << order[i].to_string() << endl;
		}
		return true;
	}

	return false;
}

void find(int N, int A, int B)
{
	Timer tmr(1.1);
	while (tmr.Over() == false)
	{
		if (find2(N, A, B))break;
	}

	if (tmr.Over())cerr << "dame" << endl;
}

vector<vector<char>>best_ans;
vector<vector<char>>ans;

void solve(int N, int A, int B, int r, int c)
{
	cerr<<r<<" " <<c<<" "<<A<<" "<<B<<endl;
	int cnt = 0;
	vector<int>index1;
	for (int i = 0; i < N; i++)
	{
		bool a = (A >> i) & 1;
		bool b = (B >> i) & 1;

		if (a^b)
		{
			index1.push_back(i);
			cnt++;
		}
	}

	int nA = 0;
	int nB = (1 << cnt) - 1;

	for (int i = (1 << (N - 1)); i < (1 << N); i++)
	{
		ans[r][c + i] = 1;
	}

	if (N == 1)
	{

		for (int i = (int)index1.size() - 1; i >= 0; i--)
		{
			int i2 = index1[i];

			for (int j = 0; j < (1 << N); j++)
			{
				swap(ans[r + i2][c + j], ans[r + cnt - 1][c + j]);
			}
			cnt--;
		}

		for (int i = 0; i < N; i++)
		{
			for (int j = 0; j < (1 << N); j++)
			{
				ans[r + i][c + j] = ((A >> i) & 1) ^ ans[r + i][c + j];
			}
		}

		return;
	}

	solve(N - 1, 0, 1, r + 1, c);
	solve(N - 1, 1, nB >> 1, r + 1, c + (1 << (N - 1)));

	for (int i = (int)index1.size() - 1; i >= 0; i--)
	{
		int i2 = index1[i];

		for (int j = 0; j < (1 << N); j++)
		{
			swap(ans[r + i2][c + j], ans[r + cnt - 1][c + j]);
		}
		cnt--;
	}

	for (int i = 0; i < N; i++)
	{
		for (int j = 0; j < (1 << N); j++)
		{
			ans[r + i][c + j] = ((A >> i) & 1) ^ ans[r + i][c + j];
		}
	}
}

int main()
{
	int N, A, B; cin >> N >> A >> B;

	int cnt = 0;
	for (int i = 0; i < N; i++)
	{
		bool a = (A >> i) & 1;
		bool b = (B >> i) & 1;

		if (a^b)cnt++;
	}
	if (cnt % 2 == 0)
	{
		cout << "NO" << endl;
		return 0;
	}

	ans.resize(N, vector<char>(1 << N));

	solve(N, A, B, 0, 0);

	cout<<"YES"<<endl;

	for (int j = 0; j < (1 << N); j++)
	{
		for (int i = 0; i < N; i++)
		{
			cerr << (int)ans[i][j];
		}
		cerr << endl;
	}
	cerr << endl;

	for (int j = 0; j < (1 << N); j++)
	{
		if(j)cout<<" ";

		int x = 0;
		for (int i = 0; i < N; i++)
		{
			x += (int)ans[i][j] << i;
		}

		cout<<x;
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 3456