Problem: 2^N players competed in a tournament. Each player has a unique ID number from 1 through 2^N. When two players play a match, the player with the smaller ID always wins.

This tournament was a little special, in which losers are not eliminated to fully rank all the players.

We will call such a tournament that involves 2^n players a full tournament of level n. In a full tournament of level n, the players are ranked as follows:

* In a full tournament of level 0, the only player is ranked first.
* In a full tournament of level n\ (1 \leq n), initially all 2^n players are lined up in a row. Then:
* First, starting from the two leftmost players, the players are successively divided into 2^{n-1} pairs of two players.
* Each of the pairs plays a match. The winner enters the "Won" group, and the loser enters the "Lost" group.
* The players in the "Won" group are lined up in a row, maintaining the relative order in the previous row. Then, a full tournament of level n-1 is held to fully rank these players.
* The players in the "Lost" group are also ranked in the same manner, then the rank of each of these players increases by 2^{n-1}.



For example, the figure below shows how a full tournament of level 3 progresses when eight players are lined up in the order 3,4,8,6,2,1,7,5. The list of the players sorted by the final ranking will be 1,3,5,6,2,4,7,8.

<image>

Takahashi has a sheet of paper with the list of the players sorted by the final ranking in the tournament, but some of it blurred and became unreadable. You are given the information on the sheet as a sequence A of length N. When A_i is 1 or greater, it means that the i-th ranked player had the ID A_i. If A_i is 0, it means that the ID of the i-th ranked player is lost.

Determine whether there exists a valid order in the first phase of the tournament which is consistent with the sheet. If it exists, provide one such order.

Constraints

* 1 \leq N \leq 18
* 0 \leq A_i \leq 2^N
* No integer, except 0, occurs more than once in A_i.

Input

Input is given from Standard Input in the following format:


N
A_1 A_2 ... A_{2^N}


Output

If there exists a valid order in the first phase of the tournament, print `YES` first, then in the subsequent line, print the IDs of the players sorted by the final ranking, with spaces in between. If there is no such order, print `NO` instead.

Examples

Input

3
0 3 0 6 0 0 0 8


Output

YES
3 4 8 6 2 1 7 5


Input

1
2 1


Output

NO

Solution (in CPP):

Solution:
// #pragma GCC target("avx")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
// #define BEGIN_STACK_EXTEND(size) void * stack_extend_memory_ = malloc(size);void * stack_extend_origin_memory_;char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);*stack_extend_dummy_memory_ = 0;asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024));
// #define END_STACK_EXTEND asm volatile("mov %%rax, %%rsp"::"a"(stack_extend_origin_memory_));free(stack_extend_memory_);

#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
#include<unordered_set>
#include<unordered_map>
#include<complex>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-11;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3100000;
const int UF_SIZE = 3100000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	inline long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	long long pw_mod(long long a,long long b,long long M){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%M;
			a=a*a%M;
			b/=2;
		}
		return ret;
	}
	int pw_mod_int(int a,int b,int M){
		if(a<0)return 0;
		if(b<0)return 0;
		int ret=1;
		while(b){
			if(b%2)ret=(long long)ret*a%M;
			a=(long long)a*a%M;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
	int UF[UF_SIZE];
	void init_UF(int n){
		for(int i=0;i<n;i++)UF[i]=-1;
	}
	int FIND(int a){
		if(UF[a]<0)return a;
		return UF[a]=FIND(UF[a]);
	}
	void UNION(int a,int b){
		a=FIND(a);b=FIND(b);if(a==b)return;
		if(UF[a]>UF[b])swap(a,b);
		UF[a]+=UF[b];UF[b]=a;
	}
}
// ここから編集しろ
int p[310000];
int L[310000];
int R[310000];
int at[310000];
int ret[310000];
int ans[310000];
int rev[310000];
pair<int,int>ev[310000];
int s[1<<18];
void dfs(vector<int>t,int l){
	if(l==0){return;}
	vector<int>L;
	vector<int>R;
	for(int i=0;i<t.size();i+=2){
		if(t[i]<t[i+1]){
			L.push_back(t[i]);
			R.push_back(t[i+1]);
			s[t[i+1]]+=(1<<(l-1));
		}else{
			L.push_back(t[i+1]);
			R.push_back(t[i]);
			s[t[i]]+=(1<<(l-1));
		}
	}
	dfs(L,l-1);
	dfs(R,l-1);
}
void main_(int n,vector<int>v){
	// int a;scanf("%d",&a);
	int a=n;
	for(int i=0;i<(1<<a);i++)at[i]=-1;
	for(int i=0;i<(1<<a);i++){
		// scanf("%d",p+i);
		p[i]=v[i];
		p[i]--;
		R[i]=p[i];
		if(R[i]==-1)R[i]=mod;
		L[i]=p[i];
		if(p[i]>=0){
			at[p[i]]=i;
		}
	}
	// for(int i=0;i<(1<<a);i++){
		// printf("%d ",p[i]);
	// }printf("\n");
	for(int i=0;i<(1<<a);i++){
		for(int j=0;j<a;j++){
			if(i&(1<<j))continue;
			L[i+(1<<j)]=max(L[i],L[i+(1<<j)]);
		}
	}
	for(int i=(1<<a)-1;i>=0;i--){
		for(int j=0;j<a;j++){
			if((i&(1<<j))==0)continue;
			R[i-(1<<j)]=min(R[i],R[i-(1<<j)]);
		}
	}
	for(int i=0;i<(1<<a);i++){
		if(L[i]>R[i]){
			printf("NO\n");return;
		}
	}
	for(int i=0;i<(1<<a);i++){
		ev[i]=make_pair(R[i],i);
	}
	std::sort(ev,ev+(1<<a));
	// for(int i=0;i<(1<<a);i++){
		// printf("%d %d\n",ev[i].first,ev[i].second);
	// }

	set<int>S;
	S.insert(mod);
	int pt=0;
	// S.insert(-1);
	// for(int i=0;i<(1<<a);i++)printf("%d %d\n",L[i],R[i]);
	for(int i=0;i<(1<<a);i++){
		int I=ev[i].second;
		int rv=ev[i].first;
		int lv=L[I];
		while(pt<=rv&&pt<(1<<a)){
			if(at[pt]==-1)S.insert(pt);
			pt++;
		}
		if(p[I]!=-1){
			if(L[I]>p[I]||R[I]<p[I]){
				printf("NO\n");return;
			}
			ret[I]=p[I];
		}else{
			int val=*(S.lower_bound(lv));

			if(val>=(1<<a)){
				printf("NO\n");return;
			}
			ret[I]=val;
			S.erase(val);
		}
	}
	for(int i=0;i<(1<<a);i++){
		rev[ret[i]]=i;
	}
	// for(int i=0;i<(1<<a);i++){
		// printf("%d\n",ret[i]);
	// }
	int sz=1;
	for(int i=0;i<a;i++){
		for(int j=0;j<(1<<i);j++){
			int A=(1<<(a-1-i))+j*(1<<(a-i));
			int B=A-(1<<(a-1-i));
			int cb=rev[ans[B]];
			ans[A]=ret[cb+(1<<i)];
		}
	}
	printf("YES\n");
	// vector<int>w(1<<a);
	// for(int i=0;i<(1<<a);i++)w[i]=ans[i];
	// for(int i=0;i<(1<<a);i++)s[i]=0;
	// dfs(w,a);
	// for(int i=0;i<(1<<a);i++){
	// 	if(p[i]!=-1&&i!=s[p[i]]){printf("no %d: %d %d\n",i,p[i],s[p[i]]);break;}
	// }
	for(int i=0;i<(1<<a);i++){
		if(i)printf(" ");
		printf("%d",ans[i]+1);
	}printf("\n");
}

int main(){
	int a;scanf("%d",&a);
	vector<int>v(1<<a);
	for(int i=0;i<(1<<a);i++){
		int t;scanf("%d",&t);
		v[i]=t;
	}
	main_(a,v);
	// while(1){
	// 	int a=rand()%18+1;
	// 	vector<int>v((1<<a));
	// 	for(int i=0;i<(1<<a);i++)v[i]=i;
	// 	random_shuffle(v.begin(),v.end());
	// 	for(int i=0;i<(1<<a);i++)s[i]=0;
	// 	dfs(v,a);
	// 	vector<int>w(1<<a);
	// 	for(int i=0;i<(1<<a);i++){
	// 		w[s[i]]=i;
	// 	}
	// 	for(int i=0;i<(1<<a);i++){
	// 		if(rand()%2)w[i]=0;
	// 		else w[i]++;
	// 	}
	// 	main_(a,w);
	// }
}