#include using namespace std; struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_; #define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i=i##_begin_;i--) #define REP(i, n) FOR(i,0,n) #define IREP(i, n) IFOR(i,0,n) template istream &operator>>(istream &is, vector &vec){ for (auto &v : vec) is >> v; return is; } template ostream &operator<<(ostream &os, const vector &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; } #define dbg(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ") " << __FILE__ << endl; void output(vector v) { for (auto x : v) cout << x << ' '; cout << '\n'; exit(0); } int in() { int x; cin >> x; return x; } int main() { const int N = in(), P = in(), Q = in(); vector A(N); cin >> A; set s; bool fp = false, fq = false; IREP(i, N) { if (A[i] == P) fp = true; if (A[i] == Q) fq = true; s.insert(A[i]); if (fp and fq and s.size() == 2 and P > Q) { A[N - 2] = P, A[N - 1] = Q; output(A); } if (fp and fq and *prev(s.end()) > A[i] and s.size() > 2) { int x = *s.upper_bound(A[i]); if (x == Q and fp) x = *next(s.upper_bound(A[i])); A[i] = x; s.erase(x); if (x == P) fp = false; FOR(j, i + 1, N) { A[j] = *s.begin(); if (A[j] == Q and fp) A[j] = *next(s.begin()); s.erase(A[j]); if (A[j] == P) fp = false; } output(A); } } puts("-1"); }