#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* #include using namespace boost::multiprecision; */ using namespace std; using ll = long long; using ull = unsigned long long; #define REP(i,a,b) for(ll i = a; i < b; ++i) #define PRI(s) std::cout << s << endl #define PRIF(v, n) printf("%."#n"f\n", (double)v) templatevoid mins(A& a, const B& b) { a = min(a, (A)b); }; templatevoid maxs(A& a, const B& b) { a = max(a, (A)b); }; int main() { ll N, X, Y; cin >> N >> X >> Y; vector A(N+1); vector P; A[0] = X; REP(i, 1, N+1) cin >> A[i]; reverse(A.begin(), A.end()); ll a = Y; ll b = ~Y; REP(i, 0, N) { if ((~A[i] & a) == 0) { if ((b & A[i]) == 0) { if(P.size() < N) P.push_back(3); while (P.size() != N) P.push_back(1); reverse(P.begin(), P.end()); for (ll p : P) cout << p << " "; cout << endl; return 0; } b = b & A[i]; P.push_back(1); } else if ((b & A[i]) == 0) { a = a & ~A[i]; P.push_back(2); } else { PRI(-1); return 0; } } PRI(-1); return 0; }