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>
using namespace std;

typedef long long ll;

ll n,x,a,o;
unordered_set<ll> num;
unordered_set<ll> t;
vector<ll> s;

void error(){
	cout << "No" << endl;
	// for(ll x : s){
	// 	cerr << x << " ";
	// }
	// cerr << endl;
	exit(0);
}

int main(){
	cin >> n >> x >> a >> o;
	for(ll i = 0;i < 1<<(n+1);i++){
		num.insert(i);
	}
	if(x == 0) error();
	if((a^o) == x) error();
	if(num.find(a^x) != num.end()) num.erase(num.find(a^x));
	if(num.find(o^x) != num.end()) num.erase(num.find(o^x));
	if(num.find(a) != num.end()) num.erase(num.find(a));
	if(num.find(o) != num.end()) num.erase(num.find(o));
	// if(((a^x)&(o^x)) == a || ((a^x)|(o^x)) == o) error();
	t.insert(a^x);
	t.insert(o^x);
	// cerr << (a^x) << " " << (o^x) << endl;
	// cerr << 1 << endl;
	while(true){
		while(t.size() > 0){
			ll hoge = *t.begin();
			t.erase(t.begin());
			s.push_back(hoge);
			vector<ll> tmp;
			for(ll y : num){
				// cerr << y << " | " << (y&hoge) << " " << (y|hoge) << endl;
				if((y&hoge) == a || (y|hoge) == o){
					// cerr << y << endl;
					tmp.push_back(y);
					tmp.push_back(y^x);
					// if(((y^x)&hoge) == a || ((y^x)|hoge) == o) error();
					t.insert(y^x);
				}
			}
			for(ll y : tmp){
				if(num.find(y) != num.end()) num.erase(num.find(y));
			}

		}
		if(num.size() > 0){
			// cerr << "------------" << endl;
			ll hoge = *num.begin();
			if(num.find(hoge) != num.end()) num.erase(num.find(hoge));
			if(num.find(hoge^x) != num.end()) num.erase(num.find(hoge^x));
			t.insert(hoge);
		}else{
			break;
		}
	}
	for(ll b1 : s){
		for(ll b2 : s){
			if((b1^b2) == x || (b1&b2) == a || (b1|b2) == o) error();
		}
	}
	cout << "Yes" << endl;
	for(ll i = 0;i < s.size()-1;i++){
		cout << s[i] << " ";
	}
	cout << s[s.size()-1] << endl;



}