#include #include #include #include #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 std; typedef long long ll; using ull = unsigned long long; 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; } //template T gcd(T a, T b) { a = abs(a), b = abs(b); while (b > 0) { tie(a, b) = make_pair(b, a % b); }return a; } //mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); constexpr long long INF = 1LL << 60; constexpr int inf = 1000000007; //constexpr long long mod = 1000000007LL; constexpr long long mod = 998244353; int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); int n; ll X, Y; cin >> n >> X >> Y; vector a(n + 1); for (int i = 1; i <= n; i++) cin >> a[i]; a[0] = X; vector b(61); for (int i = 0; i < 61; i++) b[i] = Y >> i & 1; vector res(n, 3); n += 1; for (int i = n - 1; i >= 0; i--) { int f1 = 0, f2 = 0; for (int bit = 0; bit < 61; bit++) { if (b[bit] == -1) continue; int yb = b[bit]; int ab = a[i] >> bit & 1; if (yb and !ab) f1 = true; if (!yb and ab) f2 = true; } if (f1 and f2) { cout << -1 << "\n"; return 0; } if (f1) { if(i) res[i - 1] = 2; for (int bit = 0; bit < 61; bit++) { if (b[bit] == -1) continue; int yb = b[bit]; int ab = a[i] >> bit & 1; if (yb and ab) b[bit] = -1; } } else if (f2) { if(i) res[i - 1] = 1; for (int bit = 0; bit < 61; bit++) { if (b[bit] == -1) continue; int yb = b[bit]; int ab = a[i] >> bit & 1; if (!yb and !ab) b[bit] = -1; } } else { for (int i = 0; i < res.size(); i++) { cout << res[i] << " \n"[i + 1 == res.size()]; } return 0; } } cout << -1 << "\n"; }