#include using namespace std; int main() { int N; cin >> N; vector< int > A(1 << N); for(auto &a : A) cin >> a; vector< int > B{A}; for(auto &b : B) if(b == -1) b = (1 << 30) - 1; vector< vector< pair< int, int > > > mada(1 << N); for(int a = 0; a < (1 << N); a++) { for(int b = 0; b < (1 << N); b++) { mada[a].emplace_back(b, a ^ b); } } for(int i = 29; i >= 0; i--) { queue< int > que; for(int j = 0; j < N; j++) { if((~B[i] >> i) & 1) { que.emplace(j); } } while(not que.empty()) { int a = que.front(); que.pop(); for(auto&[b, c] : mada[a]) { int one = 0; one += (B[b] >> i) & 1; one += (B[c] >> i) & 1; if(one == 1) { if((B[b] >> i) & 1) { B[b] ^= 1 << i; que.emplace(b); } else { B[c] ^= 1 << i; que.emplace(c); } } } } vector< vector< pair< int, int > > > nxt(1 << N); for(int a = 0; a < (1 << N); a++) { for(auto&[b, c] : mada[a]) { if((~B[a] >> i) & 1 or (~B[b] >> i) & 1 or (~B[c] >> i) & 1) { nxt[a].emplace_back(b, c); } } } mada = move(nxt); } for(int i = 0; i < (1 << N); i++) { if(~A[i] and A[i] != B[i]) { cout << "No\n"; return 0; } } cout << "Yes\n"; for(int i = 0; i < (1 << N); i++) { if(i) cout << " "; cout << B[i]; } cout << "\n"; }