#include #include #include #include #include #include #include #include #include #include #include #include #define debug_value(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << #x << "=" << x << endl; #define debug(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << x << endl; template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } using namespace std; typedef long long ll; int n; ll x, y; vector a; vector as_vec(ll x){ vector v(60); for(int i = 0; i < 60; i++){ if(((ll)1< &p, vector v){ // debug_value(i); if(i < 0) { for(int i = 0; i < 60; i++){ if(x&((ll)1< p){ for(int i = 0; i < n; i++){ int t = p[i]; if(t == 1) x &= a[i]; if(t == 2) x |= a[i]; if(t == 3) x = a[i]; } return x; } void get_vec(vector &a){ int n = a.size(); for(int i = 0; i < n; i++) cin >> a[i]; } int main(){ ios::sync_with_stdio(false); cin.tie(0); cout << setprecision(10) << fixed; cin >> n >> x >> y; a.resize(n); get_vec(a); vector p(n, 1); vector v = as_vec(y); if(dfs(n-1, p, v)) { assert(test(x, p) == y); for(int x : p) cout << x << ' '; cout << endl; }else{ cout << -1 << endl; } }