Problem: D: XORANDORBAN

Problem Statement

You are given a positive integer N. Your task is to determine a set S of 2^N integers satisfying the following conditions:

* All the integers in S are at least 0  and less than 2^{N+1}.
* All the integers in S are distinct.
* You are also given three integers X, A, and O, where 0 \leq X, A, O < 2^{N+1}. Then, any two integers (a, b) in S must satisfy a {\it xor} b \neq X, a {\it and} b \neq A, a {\it or} b \neq O, where {\it xor}, {\it and}, {\it or} are bitwise xor, bitwise and, bitwise or, respectively. Note that a and b are not necessarily different.



Input


N X A O

Constraints

* 1 \leq N \leq 13
* 0 \leq X, A, O < 2^{N+1}
* Inputs consist only of integers.



Output

If there is no set satisfying the conditions mentioned in the problem statement, output `No` in a line. Otherwise, output `Yes` in the first line, and then output 2^N integers in such a set in the second line. If there are multiple sets satisfying the conditions, you can output any of them.

Sample Input 1


2 6 1 5

Output for Sample Input 1


Yes
0 3 4 7


Sample Input 2


3 0 5 1

Output for Sample Input 2


No

Sample Input 3


3 4 2 5

Output for Sample Input 3


Yes
1 0 6 15 8 9 14 7






Example

Input

2 6 1 5


Output

Yes
0 3 4 7

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
#define ll long long
#define maxn 16505 /*rem*/
#define mod 998244353
#define db double
#define vi vector<int>
#define pb push_back
#define mp make_pair
#define pi pair<int, int>
#define fi first
#define se second
using namespace std;
ll ksm(ll a, ll b) {
   if (!b) return 1;
   ll ns = ksm(a, b >> 1);
   ns = ns * ns % mod;
   if (b & 1) ns = ns * a % mod;
   return ns;
}
vi eg[maxn];
int f[maxn];
int dfn[maxn], low[maxn], dfcnt, inq[maxn];
int top = 0;
int bl[maxn];
int s[maxn];
vector<vi> tr;
void dfs(int a) {
	s[top++] = a; inq[a] = 1;
	dfn[a] = low[a] = ++dfcnt;
	for (auto v : eg[a]) {
		if (!dfn[v]) dfs(v), low[a] = min(low[a], low[v]);
		else {
			if (inq[v]) low[a] = min(low[a], dfn[v]);
		} 
	} 
	if (low[a] == dfn[a]) {
		vi cur;
		while (1) {
			int g = s[top - 1];
			cur.pb(g);
			inq[g] = 0;
			bl[g] = tr.size();
			top--;
			if (g == a) break; 
		} 
		tr.pb(cur);
	}
}
int fn[maxn], fl[maxn];
int tt[maxn];
int tp[maxn];
int n, x, a, o;
int main() {
	cin >> n >> x >> a >> o;
	if (x == 0) {
		cout << "No" << endl;
		return 0;
	}
	int s = (1 << (n + 1));
	for (int i = 0; i < s; i++) {
		int nc = 0;
		for (int j = 0; j < s; j++)
			if ((i ^ j) == x || ((i & j) == a) || ((i | j) == o)) tt[nc++] = j ^ x;
		eg[i].resize(nc);
		for (int j = 0; j < nc; j++)
			eg[i][j] = tt[j];//, cout << "ADE" << i << ' ' << tt[j] << endl;
	}
	for (int i = 0; i < s; i++)
		if (!dfn[i]) dfs(i); // fl : 每个数能不能选 
	for (int i = 0; i < s; i++) {
		fl[i] = 1;
		if (bl[i] == bl[i ^ x]) {
			cout << "No" << endl;
			return 0;
		}
	}
	vi fn;
	for (int i = 0; i < tr.size(); i++) {
		bool nfl = 1;
		for (auto v : tr[i]) {
		//	cout << i << ' ' << v << endl;
			for (auto q : eg[v]) {
				if (!fl[q]) fl[v] = 0;
			}
			if (!fl[v]) nfl = 0;
		}
		if (nfl) {
			for (auto v : tr[i]) 
				fn.pb(v), 
				fl[v ^ x] = 0;
		}
	}
	cout << "Yes" << endl;
	for (int i = 0; i < fn.size(); i++) {
		printf("%d", fn[i]);
		if (i == fn.size() - 1) printf("\n");
		else printf(" ");
	}
	return 0;
}
/*
13 1231 21 37
*/