#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cstdlib>

using namespace std;
typedef long long llong;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<llong, llong> pll;

void fail(int i) {
    printf("NO\n");
    exit(0);
}

int bitRev(int x, int n) {
    int r = 0;
    for (int i = 0; i < n; ++i) {
        r <<= 1;
        r ^= (x & 1);
        x >>= 1;
    }
    return r;
}

int n, m;
int a[1 << 18];
int mn[1 << 18];
int mx[1 << 18];
int val[1 << 18];
int ans[1 << 18];
vector<pii> ord[1 << 18];
int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> n;
	m = (1 << n);
	for (int i = 0; i < m; ++i) {
        cin >> a[i];
        --a[i];
	}
	for (int i = 0; i < m; ++i) {
        mn[i] = 0;
        if (a[i] != -1) mn[i] = a[i];
        for (int j = 0; j < n; ++j) {
            if ((i >> j) & 1)
                mn[i] = max(mn[i], mn[i ^ (1 << j)] + 1);
        }
	}
	
	for (int i = m; i--; ) {
        mx[i] = m - 1;
        if (a[i] != -1) mx[i] = a[i];
        for (int j = 0; j < n; ++j) {
            if ((i >> j) & 1) continue;
            mx[i] = min(mx[i], mx[i ^ (1 << j)] - 1);
        }
	}
	for (int i = 0; i < m; ++i) {
        ord[mn[i]].emplace_back(mx[i], i);
	}
	set<pii> mp;
	for (int it = 0; it < m; ++it) {
        for (pii i : ord[it]) {
            mp.insert(i);
        }
        if (mp.empty()) fail(0);
        int r, j;
        tie(r, j) = *mp.begin();
        mp.erase(mp.begin());
        if (r < it) fail(1);
        val[j] = it;
	}
	printf("YES\n");
	for (int i = 0; i < m; ++i) {
        printf("%d%c", val[bitRev(i, n)] + 1, "\n "[i + 1 < m]);
	}
	return 0;
}
