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;
#define fi first
#define se second
#define all(v) (v).begin(), (v).end()
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,b) FOR(i,0,b)
#define reps FOR
#define eb emplace_back
#define pb eb

template<class T> inline bool chmax(T &l, const T &r) { return l<r?l=r,1:0;}
template<class T> inline bool chmin(T &l, const T &r) { return l>r?l=r,1:0;}

using vint=vector<int>;
using pint=pair<int,int>;


typedef vector<vector<int>>Graph;
struct Scc{
  stack<int>S;
  vector<int>inS,low,num;
  int time=0;

  Graph dag;
  vector<int>inv;
  vector<vector<int>>scc;
  void visit(const Graph &g,int v){
    low[v]=num[v]=++time;
    S.push(v);inS[v]=1;
    for(const int &w:g[v]){
      if(!num[w]){
        visit(g,w);
        low[v]=min(low[v],low[w]);
      }
     else if(inS[w])low[v]=min(low[v],num[w]);
    }
    if(low[v]==num[v]){
      scc.eb();
      while(1){
        int w=S.top();S.pop();inS[w]=0;
        scc.back().pb(w);
        if(v==w)break;
      }
    }
  }
  Scc(const Graph &g){
    const int n=g.size();
    num.resize(n);low.resize(n);inS.resize(n);
    rep(u,n)if(!num[u])visit(g,u);
    reverse(all(scc));
    inv.resize(n);
    rep(i,scc.size())for(auto v:scc[i])inv[v]=i;
  }   
};

int N,X,A,O;


int po(int a){
  if((a^X)>a)return a;
  return a^X;
}

int ne(int a){
  return po(a)^X;
}

signed main(){
   cin>>N>>X>>A>>O;
   if(X==0){
    cout<<"No"<<endl;return 0;
   }

  int m=1<<(N+1);
  
  Graph g(m);
  g[A].pb(A^X);
  g[O].pb(O^X);

  rep(i,m){
   if((i&A)!=A)continue;
   int b=(1<<(N+1))-1-i;
   int bs=b;
   while(true){
    int uku=A|bs;
    if(i!=uku){
      g[i].pb(uku^X);
    }
    if(bs==0)break;
    bs=(bs-1)&b;
   }
  }


  rep(i,m){
    if((i&O)!=i)continue;
    int b=i;
    int bs=b;
    while(true){
      int uku=(O-i)+bs;
      if(i!=uku){
        g[i].pb(uku^X);
      }
      if(bs==0)break;
      bs=(bs-1)&b;
    }
  }


  Scc S(g);

  vint ans;
  rep(i,m){
    if(S.inv[i]==S.inv[i^X]){
      cout<<"No"<<endl;
      return 0;
    }
    if(S.inv[i]>S.inv[i^X])ans.pb(i);
  }
  cout<<"Yes"<<endl;
  rep(i,ans.size()){
    if(i)cout<<" ";
    cout<<ans[i];
  }
  cout<<endl;
}