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:
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> P1;
#define fi first
#define sc second
#define mp make_pair
#define pb push_back
#define INF 100000000
int a[(1<<18)],n,ans[(1<<18)];
bool used[(1<<18)],bad;
vector<int>G[(1<<18)],R[(1<<18)];
int rev[(1<<18)],in[(1<<18)];
void solve(int L,int R,vector<int>zan){
	if(L == R){
		ans[L] = zan[0];
		return;
	}
	vector<int>lb,ub;
	for(int i=L;i<R;i+=2){
		if(zan[i-L] > zan[i+1-L]) bad = 1;
		lb.push_back(zan[i-L]);
		ub.push_back(zan[i+1-L]);
	}
	solve(L,(L+R)/2,lb);
	solve((L+R)/2+1,R,ub);
}
int mn[(1<<18)],mx[(1<<18)];
vector<P>vec[(1<<18)];
vector<int>zan;
int main() {
	cin>>n;
	for(int i=0;i<(1<<n);i++){
		cin>>a[i];
		a[i]--;
		if(a[i] >= 0){
			used[a[i]] = 1;
		}
	}
	for(int i=0;i<(1<<n);i++) if(!used[i]) zan.pb(i);
	for(int i=0;i<(1<<n);i++){
		mn[i] = 0;
		mx[i] = INF;
		if(a[i] >= 0){
			mn[i] = mx[i] = a[i];
		}
	}
	for(int i=0;i<(1<<n);i++){
		for(int j=0;j<n;j++){
			if(((i>>j)&1)){
				mn[i] = max(mn[i],mn[i-(1<<j)]);
			}
		}
	}
	for(int i=(1<<n)-1;i>=0;i--){
		for(int j=0;j<n;j++){
			if(!((i>>j)&1)){
				mx[i] = min(mx[i],mx[i+(1<<j)]);
			}
		}
	}
	for(int i=0;i<(1<<n);i++){
		if(mn[i] > mx[i]){
			puts("NO"); return 0;
		}
		if(a[i] == -1) vec[mn[i]].pb(mp(mx[i],i));
	}

	for(int i=0;i<(1<<n);i++) sort(vec[i].begin(),vec[i].end());
	priority_queue<P,vector<P>,greater<P> >que;
	for(int i=0;i<(1<<n);i++){
		for(int j=0;j<vec[i].size();j++){
			que.push(vec[i][j]);
		}
		if(used[i]) continue;
		if(que.empty() || que.top().fi < i){
		    puts("NO"); return 0;
		}
		a[que.top().sc] = i; que.pop();
	}
	//for(int i=0;i<(1<<n);i++) cout<<a[i]<<endl;
	vector<int>zip;
	for(int i=0;i<(1<<n);i++) zip.push_back(a[i]);
	solve(0,(1<<n)-1,zip);
	if(bad) puts("NO");
	else{
		puts("YES");
		for(int i=0;i<(1<<n);i++) printf("%d ",ans[i]+1);
		puts("");
	}
}