#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<numeric>
#include<limits>
#include<bitset>
#include<functional>
#include<type_traits>
#include<queue>
#include<stack>
#include<array>
#include<random>
#include<utility>

#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
#include<boost/range/numeric.hpp>

#ifdef _MSC_FULL_VER
#include"randomizer.hpp"
#include"debug_print.hpp"
#endif

#include<cstdlib>
#include<ctime>

namespace lib
{
	template<class T>using pair = std::pair<T, T>;
	template<class T>constexpr T pow(T base, std::uint64_t p)
	{
		T ret = T(1);
		for (std::uint64_t i = 0; i <= 63; ++i)
		{
			if (((1ull << i) & p) != 0)
			{
				ret *= base;
			}
			base *= base;
		}
		return ret;
	}
	template<class T>using p_queue = std::priority_queue<T, std::vector<T>, std::greater<>>;

	struct union_find
	{
		std::vector<int> upper;
		union_find(std::size_t size):upper(size, -1) {}

		int group(int index)
		{
			if (upper[index] == -1)
			{
				return index;
			}
			else
			{
				return upper[index] = group(upper[index]);
			}
		}

		bool merge(int x, int y)
		{
			auto gx = group(x);
			auto gy = group(y);
			if (gx != gy)
			{
				upper[gx] = gy;
				return true;
			}
			return false;
		}

		auto get()
		{
			std::map<int, std::set<int>> ret;
			for (int i = 0; i < upper.size(); ++i)
			{
				ret[group(i)].emplace(i);
			}
			return ret;
		}

		auto tops()
		{
			std::set<int> ret;
			for (int i = 0; i < upper.size(); ++i)
			{
				ret.emplace(group(i));
			}
			return ret;
		}

		bool is_same_group(int x, int y)
		{
			return group(x) == group(y);
		}
	};
}

namespace out
{
	namespace detail
	{
		template<class>struct void_out
		{
			typedef void type;
		};
		template<class T>auto write(std::ostream& ost, T const& val)
			->typename void_out<decltype(ost << val)>::type
		{
			ost << val;
		}
		template<class T, class... Ts>void write(std::ostream& ost, T const& val, Ts const&... nexts)
		{
			write(ost, val);
			ost << " ";
			write(ost, nexts...);
		}
	}
	void write_line()
	{
		std::cout << std::endl;
	}
	template<class...Ts>void write_line(Ts const&... args)
	{
		detail::write(std::cout, args...);
		write_line();
	}
	template<class Range>void write_range(Range const& rng)
	{
		for (auto const& v : rng)
		{
			write_line(v);
		}
	}
}
namespace adaptor = boost::adaptors;

struct bit_shuffler
{
	int N;
	int target;
	int count;
	std::vector<int> con, inv;
	bit_shuffler(int n, int t):N(n), target(t), count(0), con(n), inv(n)
	{
		int i = 0;
		for (int k : boost::irange(0, N))
		{
			if ((target&(1 << k)) != 0)
			{
				con[k] = i;
				inv[i] = k;
				++i;
			}
		}
		count = i;
		for (int k : boost::irange(0, N))
		{
			if ((target&(1 << k)) == 0)
			{
				con[k] = i;
				inv[i] = k;
				++i;
			}
		}
	}
	int convert(int v)
	{
		int ret = 0;
		for (int k : boost::irange(0, N))
		{
			ret += (v % 2) << con[k];
			v /= 2;
		}
		return ret;
	}
	int invert(int v)
	{
		int ret = 0;
		for (int k : boost::irange(0, N))
		{
			ret += (v % 2) << inv[k];
			v /= 2;
		}
		return ret;
	}

};

void Main()
{
	int N, A, B;
	std::cin >> N >> A >> B;
	int T = A ^ B;
	bit_shuffler shuffler(N, T);
	if (shuffler.count % 2 == 0)
	{
		out::write_line("NO");
		return;
	}
	int C = shuffler.count - 1;
	std::vector<int> left[18];
	left[0] = { 0 };
	for (int i : boost::irange(0, 17))
	{
		left[i + 1].reserve(2 << i);
		for (auto a : left[i])
		{
			left[i + 1].emplace_back(a << 1);
		}
		for (auto b : left[i] | adaptor::reversed)
		{
			left[i + 1].emplace_back((b << 1) + 1);
		}
	}
	std::vector<int> right = { 0 };
	for (int i : boost::irange(0, C / 2))
	{
		std::array<int, 4> x = { 0,2,3,1 };
		std::array<int, 4> y = { 1,0,2,3 };
		std::vector<int> next;
		next.reserve(4 * right.size());
		for (int k : boost::irange<int>(0, right.size() - 1))
		{
			if (k % 2 == 0)
			{
				for (auto v : x)
				{
					next.emplace_back((v << (2 * i)) + right[k]);
				}
			}
			else
			{
				for (auto v : x | adaptor::reversed)
				{
					next.emplace_back((v << (2 * i)) + right[k]);
				}
			}
		}
		for (auto v : y)
		{
			next.emplace_back((v << (2 * i)) + right.back());
		}
		std::swap(right, next);
	}
	out::write_line("YES");
	for (int i : left[C])
	{
		std::cout << (shuffler.invert(i) ^ A) << " ";
	}
	for (int i : boost::irange<int>(1, left[N - C].size()))
	{
		int s = 0;
		if (i % 2 == 1)
		{
			for (auto v : right)
			{
				s = (left[N - C][i] << C) + v;
				std::cout << (shuffler.invert(s) ^ A) << " ";
			}
		}
		else
		{
			for (auto v : right | adaptor::reversed)
			{
				s = (left[N - C][i] << C) + v;
				std::cout << (shuffler.invert(s) ^ A) << " ";
			}
		}
	}
}

int main()
{
	std::cin.tie(nullptr);
	std::cin.sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}


Measured memory_bytes: 2048