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>
#define fi first
#define se second
#define pii pair<int,int>
#define pdi pair<db,int>
#define mp make_pair
#define pb push_back
#define enter putchar('\n')
#define space putchar(' ')
#define eps 1e-8
#define mo 974711
#define MAXN 100005
//#define ivorysi
using namespace std;
typedef long long int64;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;char c = getchar();T f = 1;
    while(c < '0' || c > '9') {
	if(c == '-') f = -1;
	c = getchar();
    }
    while(c >= '0' && c <= '9') {
	res = res * 10 + c - '0';
	c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
	out(x / 10);
    }
    putchar('0' + x % 10);
}
int A[(1 << 18) + 5],N;
vector<int> e[2][(1 << 18) + 5];
int d[2][(1 << 18) + 5];
int L[(1 << 18) + 5],R[(1 << 18) + 5];
int que[2][(1 << 18) + 5],ql,qr,ans[(1 << 18) + 5];
vector<int> st[(1 << 18) + 5],ed[(1 << 18) + 5];
struct cmp {
    bool operator () (const int &a,const int &b) const {
	return R[a] < R[b] || (R[a] == R[b] && a < b);
    }
};
set<int,cmp> S;
void Init() {
    read(N);
    for(int i = 0 ; i < (1 << N) ; ++i) {
	read(A[i]);--A[i];
	for(int j = 0 ; j < N ; ++j) {
	    if(!(i >> j & 1)) {
		e[0][i].pb(i + (1 << j));
		d[0][i + (1 << j)]++;
		e[1][i + (1 << j)].pb(i);
		d[1][i]++;
	    }
	}
	L[i] = 0;R[i] = (1 << N) - 1;
    }
}
void Solve() {
    L[0] = R[0] = 0;
    for(int i = 0 ; i < (1 << N) ; ++i) {
        if(A[i] != -1) L[i] = A[i];
        int u = i;
    	for(auto v : e[0][u]) {
    	    L[v] = max(L[v],L[u] + 1);
    	}
    }
    R[(1 << N) - 1] = L[(1 << N) - 1] = (1 << N) - 1;

    for(int i = (1 << N) - 1 ; i >= 0 ; --i) {
        if(A[i] != -1) R[i] = A[i];
    	int u = i;
    	for(auto v : e[1][u]) {
    	    R[v] = min(R[u] - 1,R[v]);
    	}
    }
    for(int i = 0 ; i < (1 << N) ; ++i) {
    	st[L[i]].pb(i);
    }
    for(int i = 0 ; i < (1 << N) ; ++i) {
        for(auto t : st[i]) S.insert(t);
        if(S.empty()) {puts("NO");return;}
        int t = *S.begin();
        S.erase(S.begin());
        if(R[t] < i) {puts("NO");return;}
        ans[t] = i;
    }

    puts("YES");
    for(int i = 1 , j = (1 << N - 1) ; i < (1 << N) - 1 ; ++i) {
    	if(i < j) swap(ans[i],ans[j]);
    	int k = (1 << N - 1);
    	while(j >= k) {
    	    j -= k;
    	    k >>= 1;
    	}
    	j += k;
    }
    for(int i = 0 ; i < (1 << N) ; ++i) {
    	out(ans[i] + 1);space;
    }
    enter;
}
int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Init();
    Solve();
    return 0;
}