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 pb push_back
#define mp make_pair
#define fi first
#define se second

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

template <typename T> bool chkmax(T &x,T y){return x<y?x=y,true:false;}
template <typename T> bool chkmin(T &x,T y){return x>y?x=y,true:false;}

int readint(){
	int x=0,f=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

int n,a,b,c,tot,ncnt,scnt;
int dfn[20000],low[20000],v[10000005],nxt[10000005],h[20000],col[20000];
bool ins[20000];
stack<int> s;

void addedge(int x,int y){v[++tot]=y; nxt[tot]=h[x]; h[x]=tot;}

void tarjan(int u){
	dfn[u]=low[u]=++ncnt;
	s.push(u); ins[u]=1;
	for(int p=h[u];p;p=nxt[p]){
		if(!dfn[v[p]]) tarjan(v[p]),chkmin(low[u],low[v[p]]);
		else if(ins[v[p]]) chkmin(low[u],dfn[v[p]]);
	}
	if(dfn[u]==low[u]){
		int tmp;
		scnt++;
		do{
			tmp=s.top(); s.pop();
			col[tmp]=scnt,ins[tmp]=0;	
		}while(tmp!=u);
	}
}

int main(){
	n=readint(); a=readint(); b=readint(); c=readint();
	if(a==0) return printf("No\n"),0;
	for(int i=0;i<(1<<(n+1));i++){
		if(((i&b)==b)||((i&c)==i))
			for(int j=i;j<(1<<(n+1));j++)
				if(((i&j)==b)||((i|j)==c))
					addedge(i,j^a),addedge(j,i^a);
	}
	for(int i=0;i<(1<<(n+1));i++) if(!dfn[i]) tarjan(i);
	for(int i=0;i<(1<<(n+1));i++) if(col[i]==col[i^a]) return printf("No\n"),0;
	printf("Yes\n");
	int num=0;
	for(int i=0;i<(1<<(n+1));i++){
		if(col[i]<col[i^a]){
			printf("%d",i);
			num++;
			if(num!=(1<<n)) printf(" ");
		}
	}
	printf("\n");
	return 0;
}