#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #pragma warning(disable:4996) //#define ATCODER #ifdef ATCODER #include #endif typedef long long ll; typedef unsigned long long ull; #define LINF 9223300000000000000 #define LINF2 1223300000000000000 #define LINF3 1000000000000 #define INF 2140000000 //const long long MOD = 1000000007; const long long MOD = 998244353; using namespace std; #ifdef ATCODER using namespace atcoder; #endif void solve() { int n; ll x, y; scanf("%d%lld%lld", &n, &x, &y); n++; vector a(n); a[0] = x; int i; for (i = 1; i < n; i++) { scanf("%lld", &a[i]); } vector curr(60); for (i = 0; i < 60; i++) { curr[i] = ((y & (1< ans(n, 1); for (i = n - 1; i >= 0; i--) { int bad0 = 0, bad1 = 0; vector vtmp(60); int k; for (k = 0; k < 60; k++) { vtmp[k]= ((a[i] & (1 << k)) ? 1 : 0); if (vtmp[k] && curr[k] == 0) bad1 = 1; if (vtmp[k] == 0 && curr[k] == 1) bad0 = 1; } if (bad0 && bad1) { printf("-1\n"); return; } if (bad0 == 0 && bad1 == 0) { ans[i] = 3; found = 1; break; } if (bad1) { ans[i] = 1; vector ne(60); for (k = 0; k < 60; k++) { ne[k] = 2; if (vtmp[k] == 1 && curr[k] == 0) ne[k] = 0; if (vtmp[k] == 1 && curr[k] == 1) ne[k] = 1; } curr.swap(ne); } else { ans[i] = 2; vector ne(60); for (k = 0; k < 60; k++) { ne[k] = 2; if (vtmp[k] == 0 && curr[k] == 1) ne[k] = 1; if (vtmp[k] == 0 && curr[k] == 0) ne[k] = 0; } curr.swap(ne); } } if (found) { for (i = 1; i < n; i++) { printf("%d", ans[i]); if (i < n - 1) printf(" "); else printf("\n"); } } else { printf("-1\n"); } return; } int main() { #if 1 solve(); #else int T, t; cin >> T; for (t = 0; t < T; t++) { //cout << "Case #" << t + 1 << ": "; solve(); } #endif return 0; }