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 <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <set>
#define SIZE (1<<18)+5

using namespace std;
typedef pair <int,int> P;

int A[SIZE];
int ans[SIZE];
int deg[SIZE];
int low[SIZE],up[SIZE];
bool use[SIZE];
vector <int> vec2[SIZE];
int n,t;

void modify1()
{
	for(int i=0;i<n;i++)
	{
		low[i]=0;
		if(ans[i]!=-1) low[i]=ans[i];
	}
	for(int i=t-1;i>=0;i--)
	{
		for(int j=1;j<1<<(t-i);j+=2)
		{
			int v=j<<i;
			for(int k=0;k<t;k++)
			{
				if(v>>k&1)//lose
				{
					low[v]=max(low[v],low[v^(1<<k)]);
				}
			}
		}
	}
}
void modify2()
{
	for(int i=0;i<n;i++)
	{
		up[i]=n-1;
		if(ans[i]!=-1) up[i]=ans[i];
	}
	int all=n-1;
	for(int i=t-1;i>=0;i--)
	{
		for(int j=1;j<1<<(t-i);j+=2)
		{
			int v=all^(j<<i);
			for(int k=0;k<t;k++)
			{
				if(!(v>>k&1))//win
				{
					up[v]=min(up[v],up[v^(1<<k)]);
				}
			}
		}
	}
}
int main()
{
	scanf("%d",&t);
	n=1;
	for(int i=0;i<t;i++) n<<=1;
	for(int i=0;i<n;i++)
	{
		scanf("%d",&A[i]);
		A[i]--;
	}
	if(A[0]>0)
	{
		puts("NO");
		return 0;
	}
	A[0]=0;
	for(int i=1;i<n;i++)
	{
		if(A[i]==0)
		{
			puts("NO");
			return 0;
		}
	}
	memset(ans,-1,sizeof(ans));
	memset(use,false,sizeof(use));
	for(int i=0;i<n;i++)
	{
		if(A[i]!=-1)
		{
			use[A[i]]=true;
			int to=0;
			for(int j=0;j<t;j++)
			{
				to<<=1;
				if(i>>j&1) to++;
			}
			ans[to]=A[i];
		}
	}
	modify1();
	modify2();
	for(int i=0;i<n;i++)
	{
		deg[i]=0;
		for(int j=0;j<t;j++)
		{
			if(!(i>>j&1))
			{
				int to=i^(1<<j);
				if(ans[to]==-1) deg[i]++;
			}
		}
		if(low[i]>up[i])
		{
			puts("NO");
			return 0;
		}
		if(ans[i]==-1) vec2[low[i]].push_back(i);
	}
	//for(int i=0;i<n;i++) printf("%d : %d %d\n",ans[i],low[i],up[i]);
	set <int> st;
	set <int>::iterator it;
	for(int i=n-1;i>=0;i--)
	{
		if(!use[i])
		{
			st.insert(i);
		}
	}
	for(int i=n-1;i>=0;i--)
	{
		if(!use[i]) continue;
		priority_queue <P> que;
		for(int j=0;j<vec2[i].size();j++)
		{
			int v=vec2[i][j];
			if(deg[v]==0)
			{
				que.push(P(up[v],v));
			}
		}
		int all=vec2[i].size();
		while(all>0)
		{
			if(que.empty())
			{
				puts("NO");
				return 0;
			}
			P p=que.top();que.pop();
			int v=p.second;
			it=st.upper_bound(up[v]);
			if(it==st.begin())
			{
				puts("NO");
				return 0;
			}it--;
			int gt=*it;
			if(gt<i)
			{
				puts("NO");
				return 0;
			}
			ans[v]=gt;
			st.erase(it);
			all--;
			for(int j=0;j<t;j++)
			{
				if(v>>j&1)
				{
					int to=v^(1<<j);
					deg[to]--;
					if(deg[to]==0)
					{
						if(low[to]==i)
						{
							que.push(P(up[to],to));
						}
					}
				}
			}
		}
	}
	puts("YES");
	for(int i=0;i<n;i++)
	{
		if(i!=0) printf(" ");
		printf("%d",ans[i]+1);
	}puts("");
	return 0;
}