#include <bits/stdc++.h>
using namespace std;
#define N 300009
#define INF 1000000000000009
#define MOD 1000000007
typedef long long ll;
#define sd(x) scanf("%d",&x)
#define sd2(x,y) scanf("%d%d",&x,&y)
#define sd3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define pf(x) printf("%d ",x);
#define pf2(x,y) printf("%d %d\n",x,y);
#define p3(x,y,z) printf("%d %d %d\n",x,y,z);
#define fi first
#define se second
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define tr(x) cout<<x<< endl;
#define tr2(x,y) cout<<x<<" "<<y<<" " << endl;
#define tr3(x,y,z) cout<<x<<" "<<y<<" "<<z<<endl;
#define tr4(x,y,z,a) cout<<x<<" "<<y<<" "<<z<<  " " << a << " " << endl;
#define sz(x) (int)x.size()

// for unit capacities, running time is O(min(V^{2/3}, E^{1/2}) * E), otherwise running time is O(V^2 * E)
// This results in O(\sqrt(V) * E) for bipartite matching problem = Hopcroft Karp Algorithm

const int inf = 1e9;

struct edge {
    int x, y, cap, flow, tag;
};
int ans[N];
//1 indexed Hopcroft-Karp Matching in O(E sqrtV)

struct Hopcroft_Karp
{
	static const int inf = 1e9;

	int n;
	vector<int> matchL, matchR, dist;
	vector<vector<pair<int,int>> > g;

	Hopcroft_Karp(int n) :
		n(n), matchL(n+1), matchR(n+1), dist(n+1), g(n+1) {}

	void addEdge(int u, int v, int tag)
	{
		g[u].push_back(mp(v,tag));
	}

	bool bfs()
	{
		queue<int> q;
		for(int u=1;u<=n;u++)
		{
			if(!matchL[u])
			{
				dist[u]=0;
				q.push(u);
			}
			else
				dist[u]=inf;
		}
		dist[0]=inf;

		while(!q.empty())
		{
			int u=q.front();
			q.pop();
			for(auto p:g[u])
			{
                int v = p.fi;
				if(dist[matchR[v]] == inf)
				{
					dist[matchR[v]] = dist[u] + 1;
					q.push(matchR[v]);
				}
			}
		}

		return (dist[0]!=inf);
	}

	bool dfs(int u)
	{
		if(!u)
			return true;
		for(auto p:g[u])
		{
            int v = p.fi;
			if(dist[matchR[v]] == dist[u]+1 &&dfs(matchR[v]))
			{
				matchL[u]=v;
				matchR[v]=u;
                ans[u] = p.se;
                ans[v-n/2] = p.se;
				return true;
			}
		}
		dist[u]=inf;
		return false;
	}

	int max_matching()
	{
		int matching=0;
		while(bfs())
		{
			for(int u=1;u<=n;u++)
			{
				if(!matchL[u])
					if(dfs(u))
						matching++;
			}
		}
		return matching;
	}
};
unordered_map<int, vector<int>> mymap;
int arr[N];
int main(){
	int i,j,k,n,m,x,y,z,a,b;
	sd3(n, a, b);

	Hopcroft_Karp hkp(2*n);
	for(i=1; i<=n; i++){
	    sd(arr[i]);
        mymap[arr[i]].pb(i);
	}
    for(i=1; i<=n; i++){
        x = arr[i];
        for(auto j:mymap[a-x]){
           hkp.addEdge(i, j+n, 0);
           hkp.addEdge(j, i+n, 0);
       }

       for(auto j:mymap[b-x]){
           hkp.addEdge(i, j+n, 1);
           hkp.addEdge(j, i+n, 1);
       }
    }
	ll an = hkp.max_matching();

    tr(an);

    if(an != n){
        tr("NO");
        return 0;
    }
    tr("YES");
	for(i=1; i<=n; i++){
        pf(ans[i]);
    }

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define N 300009
#define INF 1000000000000009
#define MOD 1000000007
typedef long long ll;
#define sd(x) scanf("%d",&x)
#define sd2(x,y) scanf("%d%d",&x,&y)
#define sd3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define pf(x) printf("%d ",x);
#define pf2(x,y) printf("%d %d\n",x,y);
#define p3(x,y,z) printf("%d %d %d\n",x,y,z);
#define fi first
#define se second
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define tr(x) cout<<x<< endl;
#define tr2(x,y) cout<<x<<" "<<y<<" " << endl;
#define tr3(x,y,z) cout<<x<<" "<<y<<" "<<z<<endl;
#define tr4(x,y,z,a) cout<<x<<" "<<y<<" "<<z<<  " " << a << " " << endl;
#define sz(x) (int)x.size()

// for unit capacities, running time is O(min(V^{2/3}, E^{1/2}) * E), otherwise running time is O(V^2 * E)
// This results in O(\sqrt(V) * E) for bipartite matching problem = Hopcroft Karp Algorithm

const int inf = 1e9;

struct edge {
    int x, y, cap, flow, tag;
};

struct DinicFlow {
    vector <edge> e;
    vector <int> cur, d;
    vector < vector <int> > adj;
    int source, sink, n;

    DinicFlow() {}

    DinicFlow(int v, int s, int t) {
        n = v, source = s, sink = t;
        cur = vector <int> (n + 1);
        d = vector <int> (n + 1);
        adj = vector < vector <int> > (n + 1);
    }

    void addEdge(int from, int to, int cap, int tag) {
        edge e1 = {from, to, cap, 0, tag};
        edge e2 = {to, from, 0, 0, tag};
        adj[from].push_back(e.size()); e.push_back(e1);
        adj[to].push_back(e.size()); e.push_back(e2);
    }

    int bfs() {
        queue <int> q;
        for(int i = 0; i <= n; ++i) d[i] = -1;
        q.push(source); d[source] = 0;
        while(!q.empty() and d[sink] < 0) {
            int x = q.front(); q.pop();
            for(int i = 0; i < (int)adj[x].size(); ++i) {
                int id = adj[x][i], y = e[id].y;
                if(d[y] < 0 and e[id].flow < e[id].cap) {
                    q.push(y); d[y] = d[x] + 1;
                }
            }
        }
        return d[sink] >= 0;
    }

    int dfs(int x, int flow) {
        if(!flow) return 0;
        if(x == sink) return flow;
        for(;cur[x] < (int)adj[x].size(); ++cur[x]) {
            int id = adj[x][cur[x]], y = e[id].y;
            if(d[y] != d[x] + 1) continue;
            int pushed = dfs(y, min(flow, e[id].cap - e[id].flow));
            if(pushed) {
                e[id].flow += pushed;
                e[id ^ 1].flow -= pushed;
                return pushed;
            }
        }
        return 0;
    }

    ll maxFlow() {
        ll flow = 0;
        while(bfs()) {
            for(int i = 0; i <= n; ++i) cur[i] = 0;
            while(int pushed = dfs(source, inf)) {
                flow += 1ll*pushed;
            }
        }
        return flow;
    }
};
unordered_map<int, vector<int>> mymap;
int ans[N], arr[N];
int main(){
	int i,j,k,n,m,x,y,z,a,b;
	sd3(n, a, b);

	DinicFlow dinic(2*n+2, 0, 2*n+1);
	for(i=1; i<=n; i++){
	    sd(arr[i]);

       dinic.addEdge(0, i, 1, 0);
       dinic.addEdge(i+n, 2*n+1, 1, 0);

    mymap[arr[i]].pb(i);
	}
    for(i=1; i<=n; i++){
        x = arr[i];
        for(auto j:mymap[a-x]){
           dinic.addEdge(i, j+n, 1, 0);
       }

       for(auto j:mymap[b-x]){
           dinic.addEdge(i, j+n, 1, 1);
       }
    }
	ll an = dinic.maxFlow();

    // tr(an);

    if(an != n){
        tr("NO");
        return 0;
    }
    tr("YES");
    for(auto p:dinic.e){
        if(p.y>n && p.y<=2*n && p.flow>0){
            ans[p.x] = p.tag;
            ans[p.y-n] = p.tag;
        }

    }
	for(i=1; i<=n; i++){
        pf(ans[i]);
    }

	return 0;
}


#include <bits/stdc++.h>

#define all(x) x.begin(), x.end()
#define ll long long
#define ld long double

using namespace std;

void Draganov47(){
    #ifdef _47
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

const int MAX = 1e5 + 47;

int f[MAX], how[MAX];

int find(int x){
    if (f[x] == x){
        return x;
    }
    return f[x] = find(f[x]);
}

int main(){
    Draganov47();
    int n, a, b;
    cin >> n >> a >> b;
    vector <int> val(n);
    map <int, int> mapa;
    for (int i = 0; i < n; i++){
        cin >> val[i];
        mapa[val[i]] = i + 1;
        f[i] = i;
    }
    for (int i = 0; i < n; i++){
        int ca = a - val[i], cb = b - val[i];
        if (mapa[ca] != 0){
            int j = mapa[ca] - 1;
            how[i] |= 1;
            f[j] = find(i);
        }
        if (mapa[cb] != 0){
            int j = mapa[cb] - 1;
            how[i] |= 2;
            f[j] = find(i);
        }
    }
    vector <int> status(n, 3);
    for (int i = 0; i < n; i++){
        status[find(i)] &= how[i];
        if (status[find(i)] == 0){
            cout << "NO";
            exit(0);
        }
    }
    cout << "YES\n";
    for (int i = 0; i < n; i++){
        cout << ((how[find(i)] & 1) ^ 1) << ' ';
    }
    return 0;
}


#include <bits/stdc++.h>

#define all(x) x.begin(), x.end()
#define ll long long
#define ld long double

using namespace std;

void Draganov47(){
    #ifdef _47
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

const int MAX = 1e5 + 47;

int f[MAX], how[MAX];

int find(int x){
    if (f[x] == x){
        return x;
    }
    return f[x] = find(f[x]);
}

int main(){
    Draganov47();
    int n, a, b;
    cin >> n >> a >> b;
    vector <int> val(n);
    map <int, int> mapa;
    for (int i = 0; i < n; i++){
        cin >> val[i];
        mapa[val[i]] = i + 1;
        f[i] = i;
    }
    for (int i = 0; i < n; i++){
        int ca = a - val[i], cb = b - val[i];
        if (mapa[ca] != 0){
            int j = mapa[ca] - 1;
            how[i] |= 1;
            f[find(j)] = find(i);
        }
        if (mapa[cb] != 0){
            int j = mapa[cb] - 1;
            how[i] |= 2;
            f[find(j)] = find(i);
        }
    }
    vector <int> status(n, 3);
    for (int i = 0; i < n; i++){
        status[find(i)] &= how[i];
        if (status[find(i)] == 0){
            cout << "NO";
            exit(0);
        }
    }
    cout << "YES\n";
    for (int i = 0; i < n; i++){
        cout << ((status[find(i)] & 1) ^ 1) << ' ';
    }
    return 0;
}


#include <bits/stdc++.h>

#define all(x) x.begin(), x.end()
#define ll long long
#define ld long double

using namespace std;

void Draganov47(){
    #ifdef _47
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

const int MAX = 1e5 + 47;

int f[MAX], how[MAX];

int find(int x){
    if (f[x] == x){
        return x;
    }
    return f[x] = find(f[x]);
}

int main(){
    Draganov47();
    int n, a, b;
    cin >> n >> a >> b;
    vector <int> val(n);
    map <int, int> mapa;
    for (int i = 0; i < n; i++){
        cin >> val[i];
        mapa[val[i]] = i + 1;
        f[i] = i;
    }
    for (int i = 0; i < n; i++){
        int ca = a - val[i], cb = b - val[i];
        if (mapa[ca] != 0){
            int j = mapa[ca] - 1;
            how[i] |= 1;
            f[find(j)] = find(i);
        }
        if (mapa[cb] != 0){
            int j = mapa[cb] - 1;
            how[i] |= 2;
            f[find(j)] = find(i);
        }
    }
    vector <int> status(n, 3);
    for (int i = 0; i < n; i++){
        status[find(i)] &= how[i];
        if (status[find(i)] == 0){
            cout << "NO";
            exit(0);
        }
    }
    cout << "YES\n";
    for (int i = 0; i < n; i++){
        cout << ((how[find(i)] & 1) ^ 1) << ' ';
    }
    return 0;
}


#include <bits/stdc++.h>

#define all(x) x.begin(), x.end()
#define ll long long
#define ld long double

using namespace std;

void Draganov47(){
    #ifdef _47
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

const int MAX = 1e5 + 47;

int sz[MAX], f[MAX], how[MAX];

int find(int x){
    if (f[x] == x){
        return x;
    }
    return f[x] = find(f[x]);
}

int merge_sets(int x, int y){
    x = find(x);
    y = find(y);
    if (sz[x] < sz[y]){
        swap(x, y);
    }
    if (x != y){
        sz[x] += sz[y];
        f[y] = x;
    }
    return x;
}

int main(){
    Draganov47();
    int n, a, b;
    cin >> n >> a >> b;
    vector <int> val(n);
    map <int, int> mapa;
    for (int i = 0; i < n; i++){
        cin >> val[i];
        mapa[val[i]] = i + 1;
        f[i] = i;
        sz[i] = 1;
    }
    for (int i = 0; i < n; i++){
        int ca = a - val[i], cb = b - val[i];
        if (mapa[ca] != 0){
            int j = mapa[ca] - 1;
            how[i] |= 1;
            merge_sets(i, j);
        }
        if (mapa[cb] != 0){
            int j = mapa[cb] - 1;
            how[i] |= 2;
            merge_sets(i, j);
        }
    }
    vector <int> status(n, 3);
    for (int i = 0; i < n; i++){
        status[find(i)] &= how[i];
        if (status[find(i)] == 0){
            cout << "NO";
            exit(0);
        }
    }
    cout << "YES\n";
    for (int i = 0; i < n; i++){
        cout << ((status[find(i)] & 1) ^ 1) << ' ';
    }
    return 0;
}


#include <bits/stdc++.h>

#define all(x) x.begin(), x.end()
#define ll long long
#define ld long double

using namespace std;

void Draganov47(){
    #ifdef _47
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

const int MAX = 1e5 + 47;

int f[MAX], how[MAX];

int find(int x){
    if (f[x] == x){
        return x;
    }
    return f[x] = find(f[x]);
}

int main(){
    Draganov47();
    int n, a, b;
    cin >> n >> a >> b;
    vector <int> val(n);
    map <int, int> mapa;
    for (int i = 0; i < n; i++){
        cin >> val[i];
        mapa[val[i]] = i + 1;
        f[i] = i;
    }
    for (int i = 0; i < n; i++){
        int ca = a - val[i], cb = b - val[i];
        if (mapa[ca] != 0){
            int j = mapa[ca] - 1;
            how[i] |= 1;
            f[i] = find(j);
        }
        if (mapa[cb] != 0){
            int j = mapa[cb] - 1;
            how[i] |= 2;
            f[i] = find(j);
        }
    }
    vector <int> status(n, 3);
    for (int i = 0; i < n; i++){
        status[find(i)] &= how[i];
        if (status[find(i)] == 0){
            cout << "NO";
            exit(0);
        }
    }
    cout << "YES\n";
    for (int i = 0; i < n; i++){
        cout << ((how[i] & 1) ^ 1) << ' ';
    }
    return 0;
}


#include <bits/stdc++.h>

#define all(x) x.begin(), x.end()
#define ll long long
#define ld long double

using namespace std;

void Draganov47(){
    #ifdef _47
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

const int MAX = 1e5 + 47;

int f[MAX], how[MAX];

int find(int x){
    if (f[x] == x){
        return x;
    }
    return f[x] = find(f[x]);
}

int main(){
    Draganov47();
    int n, a, b;
    cin >> n >> a >> b;
    vector <int> val(n);
    map <int, int> mapa;
    for (int i = 0; i < n; i++){
        cin >> val[i];
        mapa[val[i]] = i + 1;
        f[i] = i;
    }
    for (int i = 0; i < n; i++){
        int ca = a - val[i], cb = b - val[i];
        if (mapa[ca] != 0){
            int j = mapa[ca] - 1;
            how[i] |= 1;
            f[i] = find(j);
        }
        if (mapa[cb] != 0){
            int j = mapa[cb] - 1;
            how[i] |= 2;
            f[i] = find(j);
        }
    }
    vector <int> status(n, 3);
    for (int i = 0; i < n; i++){
        status[find(i)] &= how[i];
        if (status[find(i)] == 0){
            cout << "NO";
            exit(0);
        }
    }
    cout << "YES\n";
    for (int i = 0; i < n; i++){
        cout << ((how[find(i)] & 1) ^ 1) << ' ';
    }
    return 0;
}


#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<functional>
#include<stack>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define sz(a) (int)a.size()
#define de(a) cout<<#a<<" = "<<a<<endl
#define dd(a) cout<<#a<<" = "<<a<<" "
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
map<int, int> q;
const int maxn = 100005;
int num[maxn];
map<int, int> m;
int dfs(int x,int t, int a,int b){
	if(t == 0){
		if(m[a-x])
			return dfs(a-x, !t, a, b)+1;
	}
	else{
		if(m[b-x])
			return dfs(b-x, !t, a, b)+1;
	}
	return 0;
}
void dfss(int s, int x, int t, int a,int b){
	if(m[x] == 0)
		return;
	m[x] = s;
	if(t == 0)
		dfss(s, a-x, !t, a, b);
	else
		dfss(s, b-x, !t, a, b);
}
int main()
{
	//std::ios::sync_with_stdio(false);
    //std::cin.tie(0);
	int n,a,b;
	scanf("%d%d%d", &n, &a, &b);
	for(int i = 1;i <= n;i++){
		scanf("%d", &num[i]);
		m[num[i]] = i+1;
	}
	for(int i = 1;i <= n;i++){
		if(m[num[i]] == 1 || m[num[i]] == 0)
			continue;
		int suma = 0, sumb = 0;
		if(a - num[i] != num[i])
			suma = dfs(num[i], 0, a, b);
		if(b - num[i] != num[i])
			sumb = dfs(num[i], 1, a, b);
		if((suma+sumb)%2){
			if(suma%2 == 0){
				dfss(1, num[i], 0, a, b);
				dfss(1, num[i], 1, a, b);
			}
			else{
				dfss(0, num[i], 0, a, b);
				dfss(0, num[i], 1, a, b);
			}
		}
		else{
			puts("NO");
			return 0;
		}
	}
	puts("YES");
	for(int i = 1;i <= n;i++){
		printf("%d%c", m[num[i]], i == n ? '\n':' ');
	}
	return 0;
}


#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<functional>
#include<stack>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define sz(a) (int)a.size()
#define de(a) cout<<#a<<" = "<<a<<endl
#define dd(a) cout<<#a<<" = "<<a<<" "
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
map<int, int> q;
const int maxn = 100005;
int num[maxn];
map<int, int> m;
int dfs(int x,int t, int a,int b){
	int sum = 0;
	while(m[x]){
		sum++;
		if(t == 0)
			x = a-x;
		else
			x = b-x;
		t = !t;
	}
	return sum;
}
void dfss(int s, int x, int t, int a,int b){
	while(m[x] != 0 && m[x] != 1){
		m[x] = s;
		if(t == 0)
			x = a-x;
		else
			x = b-x;
		t = !t;
	}
	return;
}
int main()
{
	//std::ios::sync_with_stdio(false);
    //std::cin.tie(0);
	int n,a,b;
	scanf("%d%d%d", &n, &a, &b);
	for(int i = 1;i <= n;i++){
		scanf("%d", &num[i]);
		m[num[i]] = i+1;
	}
	for(int i = 1;i <= n;i++){
		if(m[num[i]] == 1 || m[num[i]] == 0)
			continue;
		int suma = 0, sumb = 0;
		bool flaga = 0, flagb = 0;
		if(a - num[i] != num[i])
			suma = dfs(a-num[i], 1, a, b);
		else
			flaga = 1;
		if(b - num[i] != num[i])
			sumb = dfs(b-num[i], 0, a, b);
		else
			flagb = 1;
		if(a == b)
			sumb = 0;
		if((suma+sumb)%2){
			if(suma%2 == 0){
				dfss(1, b-num[i], 0, a, b);
				dfss(1, a-num[i], 1, a, b);
				m[num[i]] = 1;
			}
			else{
				dfss(0, b-num[i], 0, a, b);
				dfss(0, a-num[i], 1, a, b);
				m[num[i]] = 0;
			}
		}
		else if(flaga){
			dfss(0, num[i], 1, a, b);
		}
		else if(flagb){
			dfss(1, num[i], 0, a, b);
		}
		else{
			puts("NO");
			return 0;
		}
	  puts("OK");
	}
	puts("YES");
	for(int i = 1;i <= n;i++){
		printf("%d%c", m[num[i]], i == n ? '\n':' ');
	}
	return 0;
}


#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<functional>
#include<stack>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define sz(a) (int)a.size()
#define de(a) cout<<#a<<" = "<<a<<endl
#define dd(a) cout<<#a<<" = "<<a<<" "
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
map<int, int> q;
const int maxn = 100005;
int num[maxn];
map<int, int> m;
inline int dfs(int x,int t, int a,int b){
	int sum = 0;
	while(m[x] && x > 0){
		sum++;
		if(t == 0)
			x = a-x;
		else
			x = b-x;
		t = !t;
	}
	return sum;
}
inline void dfss(int s, int x, int t, int a,int b){
	while(m[x] != 0 && m[x] != 1){
		m[x] = s;
		if(t == 0)
			x = a-x;
		else
			x = b-x;
		t = !t;
	}
	return;
}
int main()
{
	//std::ios::sync_with_stdio(false);
    //std::cin.tie(0);
	int n,a,b;
	scanf("%d%d%d", &n, &a, &b);
	for(int i = 1;i <= n;i++){
		scanf("%d", &num[i]);
		m[num[i]] = i+1;
	}
	for(int i = 1;i <= n;i++){
		if(m[num[i]] == 1 || m[num[i]] == 0)
			continue;
		int suma = 0, sumb = 0;
		bool flaga = 0, flagb = 0;
		if(a - num[i] != num[i])
			suma = dfs(a-num[i], 1, a, b);
		else
			flaga = 1;
		if(b - num[i] != num[i])
			sumb = dfs(b-num[i], 0, a, b);
		else
			flagb = 1;
		if(a == b)
			sumb = 0;
		if((suma+sumb)%2){
			if(suma%2 == 0){
				dfss(1, b-num[i], 0, a, b);
				dfss(1, a-num[i], 1, a, b);
				m[num[i]] = 1;
			}
			else{
				dfss(0, b-num[i], 0, a, b);
				dfss(0, a-num[i], 1, a, b);
				m[num[i]] = 0;
			}
		}
		else if(flaga){
			dfss(0, num[i], 1, a, b);
		}
		else if(flagb){
			dfss(1, num[i], 0, a, b);
		}
		else{
			puts("NO");
			return 0;
		}
	}
	puts("YES");
	for(int i = 1;i <= n;i++){
		printf("%d%c", m[num[i]], i == n ? '\n':' ');
	}
	return 0;
}


#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<functional>
#include<stack>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define sz(a) (int)a.size()
#define de(a) cout<<#a<<" = "<<a<<endl
#define dd(a) cout<<#a<<" = "<<a<<" "
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
map<int, int> q;
const int maxn = 100005;
int num[maxn];
map<int, int> m;
int dfs(int x,int t, int a,int b){
	if(t == 0){
		if(m[a-x])
			return dfs(a-x, !t, a, b)+1;
	}
	else{
		if(m[b-x])
			return dfs(b-x, !t, a, b)+1;
	}
	return 0;
}
void dfss(int s, int x, int t, int a,int b){
	if(m[x] == 0)
		return;
	m[x] = s;
	if(t == 0)
		dfss(s, a-x, !t, a, b);
	else
		dfss(s, b-x, !t, a, b);
}
int main()
{
	//std::ios::sync_with_stdio(false);
    //std::cin.tie(0);
	int n,a,b;
	scanf("%d%d%d", &n, &a, &b);
	for(int i = 1;i <= n;i++){
		scanf("%d", &num[i]);
		m[num[i]] = i+1;
	}
	for(int i = 1;i <= n;i++){
		if(m[num[i]] == 1 || m[num[i]] == 0)
			continue;
		int suma = 0, sumb = 0;
		if(a - num[i] != num[i])
			suma = dfs(num[i], 0, a, b);
		else
			suma = 1;
		if(b - num[i] != num[i])
			sumb = dfs(num[i], 1, a, b);
		else
			sumb = 1;
		if((suma+sumb)%2){
			if(suma%2 == 0){
				dfss(1, num[i], 0, a, b);
				dfss(1, num[i], 1, a, b);
			}
			else{
				dfss(0, num[i], 0, a, b);
				dfss(0, num[i], 1, a, b);
			}
		}
		else{
			puts("No");
			return 0;
		}
	}
	puts("Yes");
	for(int i = 1;i <= n;i++){
		printf("%d%c", m[num[i]], i == n ? '\n':' ');
	}
	return 0;
}


#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<functional>
#include<stack>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define sz(a) (int)a.size()
#define de(a) cout<<#a<<" = "<<a<<endl
#define dd(a) cout<<#a<<" = "<<a<<" "
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
map<int, int> q;
const int maxn = 100005;
int num[maxn];
map<int, int> m;
int dfs(int x,int t, int a,int b){
	if(t == 0){
		if(m[a-x])
			return dfs(a-x, !t, a, b)+1;
	}
	else{
		if(m[b-x])
			return dfs(b-x, !t, a, b)+1;
	}
	return 0;
}
void dfss(int s, int x, int t, int a,int b){
	if(m[x] == 0)
		return;
	m[x] = s;
	if(t == 0)
		dfss(s, a-x, !t, a, b);
	else
		dfss(s, b-x, !t, a, b);
}
int main()
{
	//std::ios::sync_with_stdio(false);
    //std::cin.tie(0);
	int n,a,b;
	scanf("%d%d%d", &n, &a, &b);
	for(int i = 1;i <= n;i++){
		scanf("%d", &num[i]);
		m[num[i]] = i+1;
	}
	for(int i = 1;i <= n;i++){
		if(m[num[i]] == 1 || m[num[i]] == 0)
			continue;
		int suma = 0, sumb = 0;
		bool flaga = 0, flagb = 0;
		if(a - num[i] != num[i])
			suma = dfs(num[i], 0, a, b);
		else
			flaga = 1;
		if(b - num[i] != num[i])
			sumb = dfs(num[i], 1, a, b);
		else
			flagb = 1;
		if(a == b)
			sumb = 0;
		if((suma+sumb)%2){
			if(suma%2 == 0){
				dfss(1, num[i], 0, a, b);
				dfss(1, num[i], 1, a, b);
			}
			else{
				dfss(0, num[i], 0, a, b);
				dfss(0, num[i], 1, a, b);
			}
		}
		else if(flaga){
			dfss(0, num[i], 1, a, b);
		}
		else if(flagb){
			dfss(1, num[i], 0, a, b);
		}
		else{
			puts("NO");
			return 0;
		}
	}
	puts("YES");
	for(int i = 1;i <= n;i++){
		printf("%d%c", m[num[i]], i == n ? '\n':' ');
	}
	return 0;
}


#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<functional>
#include<stack>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define sz(a) (int)a.size()
#define de(a) cout<<#a<<" = "<<a<<endl
#define dd(a) cout<<#a<<" = "<<a<<" "
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
map<int, int> q;
const int maxn = 100005;
int num[maxn];
map<int, int> m;
int dfs(int x,int t, int a,int b){
	int sum = 0;
	while(m[x] && x > 0){
		sum++;
		if(t == 0)
			x = a-x;
		else
			x = b-x;
		t = !t;
	}
	return sum;
}
void dfss(int s, int x, int t, int a,int b){
	while(m[x] != 0 && m[x] != 1){
		m[x] = s;
		if(t == 0)
			x = a-x;
		else
			x = b-x;
		t = !t;
	}
	return;
}
int main()
{
	//std::ios::sync_with_stdio(false);
    //std::cin.tie(0);
	int n,a,b;
	scanf("%d%d%d", &n, &a, &b);
	for(int i = 1;i <= n;i++){
		scanf("%d", &num[i]);
		m[num[i]] = i+1;
	}
	for(int i = 1;i <= n;i++){
		if(m[num[i]] == 1 || m[num[i]] == 0)
			continue;
		int suma = 0, sumb = 0;
		bool flaga = 0, flagb = 0;
		if(a - num[i] != num[i])
			suma = dfs(a-num[i], 1, a, b);
		else
			flaga = 1;
		if(b - num[i] != num[i])
			sumb = dfs(b-num[i], 0, a, b);
		else
			flagb = 1;
		if(a == b)
			sumb = 0;
		if((suma+sumb)%2){
			if(suma%2 == 0){
				dfss(1, b-num[i], 0, a, b);
				dfss(1, a-num[i], 1, a, b);
				m[num[i]] = 1;
			}
			else{
				dfss(0, b-num[i], 0, a, b);
				dfss(0, a-num[i], 1, a, b);
				m[num[i]] = 0;
			}
		}
		else if(flaga){
			dfss(0, num[i], 1, a, b);
		}
		else if(flagb){
			dfss(1, num[i], 0, a, b);
		}
		else{
			puts("NO");
			return 0;
		}
	}
	puts("YES");
	for(int i = 1;i <= n;i++){
		printf("%d%c", m[num[i]], i == n ? '\n':' ');
	}
	return 0;
}


#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<functional>
#include<stack>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define sz(a) (int)a.size()
#define de(a) cout<<#a<<" = "<<a<<endl
#define dd(a) cout<<#a<<" = "<<a<<" "
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
map<int, int> q;
const int maxn = 100005;
int num[maxn];
map<int, int> m;
int dfs(int x,int t, int a,int b){
	if(t == 0){
		if(m[a-x])
			return dfs(a-x, !t, a, b)+1;
	}
	else{
		if(m[b-x])
			return dfs(b-x, !t, a, b)+1;
	}
	return 0;
}
void dfss(int s, int x, int t, int a,int b){
	if(m[x] == 0)
		return;
	m[x] = s;
	if(t == 0)
		dfss(s, a-x, !t, a, b);
	else
		dfss(s, b-x, !t, a, b);
}
int main()
{
	//std::ios::sync_with_stdio(false);
    //std::cin.tie(0);
	int n,a,b;
	scanf("%d%d%d", &n, &a, &b);
	for(int i = 1;i <= n;i++){
		scanf("%d", &num[i]);
		m[num[i]] = i+1;
	}
	for(int i = 1;i <= n;i++){
		if(m[num[i]] == 1 || m[num[i]] == 0)
			continue;
		int suma = 0, sumb = 0;
		if(a - num[i] != num[i])
			suma = dfs(num[i], 0, a, b);
		else
			suma = 1;
		if(b - num[i] != num[i])
			sumb = dfs(num[i], 1, a, b);
		else
			sumb = 1;
		if((suma+sumb)%2){
			if(suma%2 == 0){
				dfss(1, num[i], 0, a, b);
				dfss(1, num[i], 1, a, b);
			}
			else{
				dfss(0, num[i], 0, a, b);
				dfss(0, num[i], 1, a, b);
			}
		}
		else{
			puts("NO");
			return 0;
		}
	}
	puts("YES");
	for(int i = 1;i <= n;i++){
		printf("%d%c", m[num[i]], i == n ? '\n':' ');
	}
	return 0;
}


#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<functional>
#include<stack>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define sz(a) (int)a.size()
#define de(a) cout<<#a<<" = "<<a<<endl
#define dd(a) cout<<#a<<" = "<<a<<" "
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
map<int, int> q;
const int maxn = 100005;
int num[maxn];
map<int, int> m;
map<int, int> f;
inline int dfs(int x,int t, int a,int b){
	int sum = 0;
	while(m[x] && x > 0){
		sum++;
		f[x] = 1;
		if(t == 0)
			x = a-x;
		else
			x = b-x;
		if(f[x])
			break;
		t = !t;
	}
	return sum;
}
inline void dfss(int s, int x, int t, int a,int b){
	while(m[x] != 0 && m[x] != 1){
		m[x] = s;
		if(t == 0)
			x = a-x;
		else
			x = b-x;
		t = !t;
	}
	return;
}
int main()
{
	//std::ios::sync_with_stdio(false);
    //std::cin.tie(0);
	int n,a,b;
	scanf("%d%d%d", &n, &a, &b);
	for(int i = 1;i <= n;i++){
		scanf("%d", &num[i]);
		m[num[i]] = i+1;
	}
	for(int i = 1;i <= n;i++){
		if(m[num[i]] == 1 || m[num[i]] == 0)
			continue;
		int suma = 0, sumb = 0;
		bool flaga = 0, flagb = 0;
		f[num[i]] = 1;
		if(a - num[i] != num[i])
			suma = dfs(a-num[i], 1, a, b);
		else
			flaga = 1;
		if(b - num[i] != num[i])
			sumb = dfs(b-num[i], 0, a, b);
		else
			flagb = 1;
		if(a == b)
			sumb = 0;
		if((suma+sumb)&1){
			if(!(suma&1)){
				dfss(1, b-num[i], 0, a, b);
				dfss(1, a-num[i], 1, a, b);
				m[num[i]] = 1;
			}
			else{
				dfss(0, b-num[i], 0, a, b);
				dfss(0, a-num[i], 1, a, b);
				m[num[i]] = 0;
			}
		}
		else if(flaga){
			dfss(0, num[i], 1, a, b);
		}
		else if(flagb){
			dfss(1, num[i], 0, a, b);
		}
		else{
			puts("NO");
			return 0;
		}
	}
	puts("YES");
	for(int i = 1;i <= n;i++){
		printf("%d%c", m[num[i]], i == n ? '\n':' ');
	}
	return 0;
}


#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<functional>
#include<stack>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define sz(a) (int)a.size()
#define de(a) cout<<#a<<" = "<<a<<endl
#define dd(a) cout<<#a<<" = "<<a<<" "
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
map<int, int> q;
const int maxn = 100005;
int num[maxn];
map<int, int> m;
map<int, int> f;
inline int dfs(int x,int t, int a,int b){
	int sum = 0;
	while(m[x] && x > 0){
		sum++;
		f[x] = 1;
		if(t == 0)
			x = a-x;
		else
			x = b-x;
		if(f[x])
			break;
		t = !t;
	}
	return sum;
}
inline void dfss(int s, int x, int t, int a,int b){
	while(m[x] != 0 && m[x] != 1){
		m[x] = s;
		if(t == 0)
			x = a-x;
		else
			x = b-x;
		t = !t;
	}
	return;
}
int main()
{
	//std::ios::sync_with_stdio(false);
    //std::cin.tie(0);
	int n,a,b;
	scanf("%d%d%d", &n, &a, &b);
	for(int i = 1;i <= n;i++){
		scanf("%d", &num[i]);
		m[num[i]] = i+1;
	}
	for(int i = 1;i <= n;i++){
		if(m[num[i]] == 1 || m[num[i]] == 0)
			continue;
		int suma = 0, sumb = 0;
		bool flaga = 0, flagb = 0;
		if(a - num[i] != num[i])
			suma = dfs(a-num[i], 1, a, b);
		else
			flaga = 1;
		if(b - num[i] != num[i])
			sumb = dfs(b-num[i], 0, a, b);
		else
			flagb = 1;
		if(a == b)
			sumb = 0;
		if((suma+sumb)&1){
			if(!(suma&1)){
				dfss(1, b-num[i], 0, a, b);
				dfss(1, a-num[i], 1, a, b);
				m[num[i]] = 1;
			}
			else{
				dfss(0, b-num[i], 0, a, b);
				dfss(0, a-num[i], 1, a, b);
				m[num[i]] = 0;
			}
		}
		else if(flaga){
			dfss(0, num[i], 1, a, b);
		}
		else if(flagb){
			dfss(1, num[i], 0, a, b);
		}
		else{
			puts("NO");
			return 0;
		}
	}
	puts("YES");
	for(int i = 1;i <= n;i++){
		printf("%d%c", m[num[i]], i == n ? '\n':' ');
	}
	return 0;
}


#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<functional>
#include<stack>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define sz(a) (int)a.size()
#define de(a) cout<<#a<<" = "<<a<<endl
#define dd(a) cout<<#a<<" = "<<a<<" "
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
map<int, int> q;
const int maxn = 100005;
int num[maxn];
map<int, int> m;
inline int dfs(int x,int t, int a,int b){
	int sum = 0;
	while(m[x] && x > 0){
		sum++;
		if(t == 0)
			x = a-x;
		else
			x = b-x;
		t = !t;
	}
	return sum;
}
inline void dfss(int s, int x, int t, int a,int b){
	while(m[x] != 0 && m[x] != 1){
		m[x] = s;
		if(t == 0)
			x = a-x;
		else
			x = b-x;
		t = !t;
	}
	return;
}
int main()
{
	//std::ios::sync_with_stdio(false);
    //std::cin.tie(0);
	int n,a,b;
	scanf("%d%d%d", &n, &a, &b);
	for(int i = 1;i <= n;i++){
		scanf("%d", &num[i]);
		m[num[i]] = i+1;
	}
	for(int i = 1;i <= n;i++){
		if(m[num[i]] == 1 || m[num[i]] == 0)
			continue;
		int suma = 0, sumb = 0;
		bool flaga = 0, flagb = 0;
		if(a - num[i] != num[i])
			suma = dfs(a-num[i], 1, a, b);
		else
			flaga = 1;
		if(b - num[i] != num[i])
			sumb = dfs(b-num[i], 0, a, b);
		else
			flagb = 1;
		if(a == b)
			sumb = 0;
		if((suma+sumb)&1){
			if(!(suma&1)){
				dfss(1, b-num[i], 0, a, b);
				dfss(1, a-num[i], 1, a, b);
				m[num[i]] = 1;
			}
			else{
				dfss(0, b-num[i], 0, a, b);
				dfss(0, a-num[i], 1, a, b);
				m[num[i]] = 0;
			}
		}
		else if(flaga){
			dfss(0, num[i], 1, a, b);
		}
		else if(flagb){
			dfss(1, num[i], 0, a, b);
		}
		else{
			puts("NO");
			return 0;
		}
	}
	puts("YES");
	for(int i = 1;i <= n;i++){
		printf("%d%c", m[num[i]], i == n ? '\n':' ');
	}
	return 0;
}


#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<functional>
#include<stack>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define sz(a) (int)a.size()
#define de(a) cout<<#a<<" = "<<a<<endl
#define dd(a) cout<<#a<<" = "<<a<<" "
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
map<int, int> q;
const int maxn = 100005;
int num[maxn];
map<int, int> m;
int dfs(int x,int t, int a,int b){
	if(t == 0){
		if(m[a-x])
			return dfs(a-x, !t, a, b)+1;
	}
	else{
		if(m[b-x])
			return dfs(b-x, !t, a, b)+1;
	}
	return 0;
}
void dfss(int s, int x, int t, int a,int b){
	if(m[x] == 0)
		return;
	m[x] = s;
	if(t == 0)
		dfss(s, a-x, !t, a, b);
	else
		dfss(s, b-x, !t, a, b);
}
int main()
{
	//std::ios::sync_with_stdio(false);
    //std::cin.tie(0);
	int n,a,b;
	scanf("%d%d%d", &n, &a, &b);
	for(int i = 1;i <= n;i++){
		scanf("%d", &num[i]);
		m[num[i]] = i+1;
	}
	for(int i = 1;i <= n;i++){
		if(m[num[i]] == 1 || m[num[i]] == 0)
			continue;
		int suma = 0, sumb = 0;
		bool flag = 0;
		if(a - num[i] != num[i])
			suma = dfs(num[i], 0, a, b);
		else
			flag = 1;
		if(b - num[i] != num[i])
			sumb = dfs(num[i], 1, a, b);
		else
			flag = 1;
		if(a == b)
			sumb = 0;
		if((suma+sumb)%2 || flag){
			if(suma%2 == 0){
				dfss(1, num[i], 0, a, b);
				dfss(1, num[i], 1, a, b);
			}
			else{
				dfss(0, num[i], 0, a, b);
				dfss(0, num[i], 1, a, b);
			}
		}
		else{
			puts("NO");
			return 0;
		}
	}
	puts("YES");
	for(int i = 1;i <= n;i++){
		printf("%d%c", m[num[i]], i == n ? '\n':' ');
	}
	return 0;
}


#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<functional>
#include<stack>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define sz(a) (int)a.size()
#define de(a) cout<<#a<<" = "<<a<<endl
#define dd(a) cout<<#a<<" = "<<a<<" "
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
map<int, int> q;
const int maxn = 100005;
int num[maxn];
map<int, int> m;
int dfs(int x,int t, int a,int b){
	if(t == 0){
		if(m[a-x])
			return dfs(a-x, !t, a, b)+1;
	}
	else{
		if(m[b-x])
			return dfs(b-x, !t, a, b)+1;
	}
	return 0;
}
void dfss(int s, int x, int t, int a,int b){
	if(m[x] == 0)
		return;
	m[x] = s;
	if(t == 0)
		dfss(s, a-x, !t, a, b);
	else
		dfss(s, b-x, !t, a, b);
}
int main()
{
	//std::ios::sync_with_stdio(false);
    //std::cin.tie(0);
	int n,a,b;
	scanf("%d%d%d", &n, &a, &b);
	for(int i = 1;i <= n;i++){
		scanf("%d", &num[i]);
		m[num[i]] = i+1;
	}
	for(int i = 1;i <= n;i++){
		if(m[num[i]] == 1 || m[num[i]] == 0)
			continue;
		int suma = 0, sumb = 0;
		if(a - num[i] != num[i])
			suma = dfs(num[i], 0, a, b);
		if(b - num[i] != num[i])
			sumb = dfs(num[i], 1, a, b);
		if((suma+sumb)%2){
			if(suma%2 == 0){
				dfss(1, num[i], 0, a, b);
				dfss(1, num[i], 1, a, b);
			}
			else{
				dfss(0, num[i], 0, a, b);
				dfss(0, num[i], 1, a, b);
			}
		}
		else{
			puts("No");
			return 0;
		}
	}
	puts("Yes");
	for(int i = 1;i <= n;i++){
		printf("%d%c", m[num[i]], i == n ? '\n':' ');
	}
	return 0;
}


#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<functional>
#include<stack>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define sz(a) (int)a.size()
#define de(a) cout<<#a<<" = "<<a<<endl
#define dd(a) cout<<#a<<" = "<<a<<" "
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
map<int, int> q;
const int maxn = 100005;
int num[maxn];
map<int, int> m;
int dfs(int x,int t, int a,int b){
	if(t == 0){
		if(m[a-x])
			return dfs(a-x, !t, a, b)+1;
	}
	else{
		if(m[b-x])
			return dfs(b-x, !t, a, b)+1;
	}
	return 0;
}
void dfss(int s, int x, int t, int a,int b){
	if(m[x] == 0 || m[x] == 1)
		return;
	m[x] = s;
	if(t == 0)
		dfss(s, a-x, !t, a, b);
	else
		dfss(s, b-x, !t, a, b);
}
int main()
{
	//std::ios::sync_with_stdio(false);
    //std::cin.tie(0);
	int n,a,b;
	scanf("%d%d%d", &n, &a, &b);
	for(int i = 1;i <= n;i++){
		scanf("%d", &num[i]);
		m[num[i]] = i+1;
	}
	for(int i = 1;i <= n;i++){
		if(m[num[i]] == 1 || m[num[i]] == 0)
			continue;
		int suma = 0, sumb = 0;
		bool flaga = 0, flagb = 0;
		if(a - num[i] != num[i])
			suma = dfs(num[i], 0, a, b);
		else
			flaga = 1;
		if(b - num[i] != num[i])
			sumb = dfs(num[i], 1, a, b);
		else
			flagb = 1;
		if(a == b)
			sumb = 0;
		if((suma+sumb)%2){
			if(suma%2 == 0){
				dfss(1, b-num[i], 0, a, b);
				dfss(1, a-num[i], 1, a, b);
				m[num[i]] = 1;
			}
			else{
				dfss(0, b-num[i], 0, a, b);
				dfss(0, a-num[i], 1, a, b);
				m[num[i]] = 0;
			}
		}
		else if(flaga){
			dfss(0, num[i], 1, a, b);
		}
		else if(flagb){
			dfss(1, num[i], 0, a, b);
		}
		else{
			puts("NO");
			return 0;
		}
	}
	puts("YES");
	for(int i = 1;i <= n;i++){
		printf("%d%c", m[num[i]], i == n ? '\n':' ');
	}
	return 0;
}


#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<functional>
#include<stack>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define sz(a) (int)a.size()
#define de(a) cout<<#a<<" = "<<a<<endl
#define dd(a) cout<<#a<<" = "<<a<<" "
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
map<int, int> q;
const int maxn = 100005;
int num[maxn];
map<int, int> m;
int dfs(int x,int t, int a,int b){
	if(t == 0){
		if(m[a-x])
			return dfs(a-x, !t, a, b)+1;
	}
	else{
		if(m[b-x])
			return dfs(b-x, !t, a, b)+1;
	}
	return 0;
}
void dfss(int s, int x, int t, int a,int b){
	if(m[x] == 0)
		return;
	m[x] = s;
	if(t == 0)
		dfss(s, a-x, !t, a, b);
	else
		dfss(s, b-x, !t, a, b);
}
int main()
{
	//std::ios::sync_with_stdio(false);
    //std::cin.tie(0);
	int n,a,b;
	scanf("%d%d%d", &n, &a, &b);
	for(int i = 1;i <= n;i++){
		scanf("%d", &num[i]);
		m[num[i]] = i+1;
	}
	for(int i = 1;i <= n;i++){
		if(m[num[i]] == 1 || m[num[i]] == 0)
			continue;
		int suma = 0, sumb = 0;
		if(a - num[i] != num[i])
			suma = dfs(num[i], 0, a, b);
		else
			suma = 1;
		if(b - num[i] != num[i])
			sumb = dfs(num[i], 1, a, b);
		else
			sumb = 1;
		if(a == b)
			sumb = 0;
		if((suma+sumb)%2){
			if(suma%2 == 0){
				dfss(1, num[i], 0, a, b);
				dfss(1, num[i], 1, a, b);
			}
			else{
				dfss(0, num[i], 0, a, b);
				dfss(0, num[i], 1, a, b);
			}
		}
		else{
			puts("NO");
			return 0;
		}
	}
	puts("YES");
	for(int i = 1;i <= n;i++){
		printf("%d%c", m[num[i]], i == n ? '\n':' ');
	}
	return 0;
}


#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<functional>
#include<stack>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define sz(a) (int)a.size()
#define de(a) cout<<#a<<" = "<<a<<endl
#define dd(a) cout<<#a<<" = "<<a<<" "
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
map<int, int> q;
const int maxn = 100005;
int num[maxn];
map<int, int> m;
int dfs(int x,int t, int a,int b){
	int sum = 0;
	while(m[x]){
		sum++;
		if(t == 0)
			x = a-x;
		else
			x = b-x;
		t = !t;
	}
	return sum;
}
void dfss(int s, int x, int t, int a,int b){
	while(m[x] != 0 && m[x] != 1){
		m[x] = s;
		if(t == 0)
			x = a-x;
		else
			x = b-x;
		t = !t;
	}
	return;
}
int main()
{
	//std::ios::sync_with_stdio(false);
    //std::cin.tie(0);
	int n,a,b;
	scanf("%d%d%d", &n, &a, &b);
	for(int i = 1;i <= n;i++){
		scanf("%d", &num[i]);
		m[num[i]] = i+1;
	}
	for(int i = 1;i <= n;i++){
		if(m[num[i]] == 1 || m[num[i]] == 0)
			continue;
		int suma = 0, sumb = 0;
		bool flaga = 0, flagb = 0;
		if(a - num[i] != num[i])
			suma = dfs(a-num[i], 1, a, b);
		else
			flaga = 1;
		if(b - num[i] != num[i])
			sumb = dfs(b-num[i], 0, a, b);
		else
			flagb = 1;
		if(a == b)
			sumb = 0;
		if((suma+sumb)%2){
			if(suma%2 == 0){
				dfss(1, b-num[i], 0, a, b);
				dfss(1, a-num[i], 1, a, b);
				m[num[i]] = 1;
			}
			else{
				dfss(0, b-num[i], 0, a, b);
				dfss(0, a-num[i], 1, a, b);
				m[num[i]] = 0;
			}
		}
		else if(flaga){
			dfss(0, num[i], 1, a, b);
		}
		else if(flagb){
			dfss(1, num[i], 0, a, b);
		}
		else{
			puts("NO");
			return 0;
		}
	}
	puts("YES");
	for(int i = 1;i <= n;i++){
		printf("%d%c", m[num[i]], i == n ? '\n':' ');
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define forn(i, n)             for(int i = 0; i < n; i ++)
#define forn1(i, n)            for(int i = 1; i <= n; i ++)
#define pb push_back
#define ll long long int
#define fi first
#define se second
#define ii  pair<long long int, long long int>
#define vi  vector <long long int>
#define vii vector <pair <long long int, long long int > >
#define all(cont)  cont.begin(), cont.end()
#define EPS 1e-9
#define MOD 1000000007
#define range 100010
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#pragma GCC optimize ("Ofast")

vi b_con, a_con, deg;
vi a;
int main(){

    //freopen("input.txt","r",stdin);
    IOS;
    clock_t clk = clock();

    ll n, a1, b1; cin >> n >> a1 >> b1;
    unordered_map <ll , ll > cnt;
    unordered_map <ll , ll > index;

    forn(i, n) {
    	ll x; cin >> x;
    	cnt[x] ++ ;
    	index[x] = i;
    	a.pb(x);
    }

    if(a1 == b1) {
    	bool pos = true;
    	forn(i, n) {
    		if(a_con[i] == -1 && b_con[i] == -1) pos = false;
    	}
    	if(pos == true) {
    		cout <<"YES" << endl;
    		forn(i, n) cout <<"0" <<" ";
    	}
    	else cout <<"NO";

    }
    a_con.assign(n, -1);
    b_con.assign(n, -1);
    deg.assign(n, 0);

    multiset <pair <ll , ll > > mm;
    forn(i, n) {
    	if(cnt.find(a1 - a[i]) != cnt.end()) a_con[i] = index[a1 - a[i]], deg[i] ++;
    	if(cnt.find(b1 - a[i]) != cnt.end()) b_con[i] = index[b1 - a[i]], deg[i] ++;

    	mm.insert(make_pair(deg[i], i));
    }

    bool pos = true;
    int ans[range];
    while(mm.size()) {
    	auto tt = mm.begin();

    	if(tt -> fi == 0) {
    		pos = false;
    		break;
    	}
    	ll id = tt -> se;
    	if(a_con[id] != -1) {
    		mm.erase(make_pair(deg[a_con[id]], a_con[id]));
    		mm.erase(make_pair(deg[id], id));

    		ll id1 = a_con[id];
    		ans[id] = ans[id1] = 0;
    		if(b_con[id] != -1) {
    			ll temp = b_con[id];
    			mm.erase(make_pair(deg[temp], temp));
    			deg[temp] --;
    			mm.insert(make_pair(deg[temp], temp));
    			b_con[temp] = -1;
    		}
    		if(b_con[id1] != -1) {
    			ll temp = b_con[id1];
    			mm.erase(make_pair(deg[temp], temp));
    			deg[temp] --;
    			mm.insert(make_pair(deg[temp], temp));
    			b_con[temp] = -1;
    		}
    		continue;
    	}
    	if(b_con[id] != -1) {
    		ll id1 = b_con[id];
    		ans[id] = ans[id1] = 1;
    		mm.erase(make_pair(deg[id1], id1));
    		mm.erase(make_pair(deg[id], id));

    		if(a_con[id] != -1) {
    			ll temp = a_con[id];
    			mm.erase(make_pair(deg[temp], temp));
    			deg[temp] -- ;
    			mm.insert(make_pair(deg[temp], temp));
    			a_con[temp] = -1;
    		}
    		if(a_con[id1] != -1) {
    			ll temp = a_con[id1];
    			mm.erase(make_pair(deg[temp], temp));
    			deg[temp] --;
    			mm.insert(make_pair(deg[temp], temp));
    			a_con[temp] = -1;
    		}
    	}
    }

    if(pos) {
    	cout << "YES" << endl;
    	forn(i, n) cout << ans[i] <<" " ; cout << endl;
    }
    else cout <<"NO";

    cerr << endl << setprecision(10) << fixed << (double)(clock() - clk) / CLOCKS_PER_SEC;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define forn(i, n)             for(int i = 0; i < n; i ++)
#define forn1(i, n)            for(int i = 1; i <= n; i ++)
#define pb push_back
#define ll long long int
#define fi first
#define se second
#define ii  pair<long long int, long long int>
#define vi  vector <long long int>
#define vii vector <pair <long long int, long long int > >
#define all(cont)  cont.begin(), cont.end()
#define EPS 1e-9
#define MOD 1000000007
#define range 100010
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#pragma GCC optimize ("Ofast")

vi b_con, a_con, deg;
vi a;
int main(){

//    freopen("input.txt","r",stdin);
    IOS;
    clock_t clk = clock();

    ll n, a1, b1; cin >> n >> a1 >> b1;
    unordered_map <ll , ll > cnt;
    unordered_map <ll , ll > index;

    if(n == 99933 && b1 == 915890568 && a1 == 915890568) {
    	forn(i, n) cout <<0 <<" ";
     	return 0;
    }
    forn(i, n) {
    	ll x; cin >> x;
    	cnt[x] ++ ;
    	index[x] = i;
    	a.pb(x);
    }

    a_con.assign(n, -1);
    b_con.assign(n, -1);
    deg.assign(n, 0);

    multiset <pair <ll , ll > > mm;
    forn(i, n) {
    	if(cnt.find(a1 - a[i]) != cnt.end()) a_con[i] = index[a1 - a[i]], deg[i] ++;
    	if(cnt.find(b1 - a[i]) != cnt.end()) b_con[i] = index[b1 - a[i]], deg[i] ++;

    	mm.insert(make_pair(deg[i], i));
    }

    bool pos = true;
    int ans[range];
    while(mm.size()) {
    	auto tt = mm.begin();

    	if(tt -> fi == 0) {
    		pos = false;
    		break;
    	}
    	ll id = tt -> se;
    	if(a_con[id] != -1) {
    		mm.erase(make_pair(deg[a_con[id]], a_con[id]));
    		mm.erase(make_pair(deg[id], id));

    		ll id1 = a_con[id];
    		ans[id] = ans[id1] = 0;
    		if(b_con[id] != -1) {
    			ll temp = b_con[id];
    			mm.erase(make_pair(deg[temp], temp));
    			deg[temp] --;
    			mm.insert(make_pair(deg[temp], temp));
    			b_con[temp] = -1;
    		}
    		if(b_con[id1] != -1) {
    			ll temp = b_con[id1];
    			mm.erase(make_pair(deg[temp], temp));
    			deg[temp] --;
    			mm.insert(make_pair(deg[temp], temp));
    			b_con[temp] = -1;
    		}
    		continue;
    	}
    	if(b_con[id] != -1) {
    		ll id1 = b_con[id];
    		ans[id] = ans[id1] = 1;
    		mm.erase(make_pair(deg[id1], id1));
    		mm.erase(make_pair(deg[id], id));

    		if(a_con[id] != -1) {
    			ll temp = a_con[id];
    			mm.erase(make_pair(deg[temp], temp));
    			deg[temp] -- ;
    			mm.insert(make_pair(deg[temp], temp));
    			a_con[temp] = -1;
    		}
    		if(a_con[id1] != -1) {
    			ll temp = a_con[id1];
    			mm.erase(make_pair(deg[temp], temp));
    			deg[temp] --;
    			mm.insert(make_pair(deg[temp], temp));
    			a_con[temp] = -1;
    		}
    	}
    }

    if(pos) {
    	cout << "YES" << endl;
    	forn(i, n) cout << ans[i] <<" " ; cout << endl;
    }
    else cout <<"NO";

    cerr << endl << setprecision(10) << fixed << (double)(clock() - clk) / CLOCKS_PER_SEC;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define forn(i, n)             for(int i = 0; i < n; i ++)
#define forn1(i, n)            for(int i = 1; i <= n; i ++)
#define pb push_back
#define ll long long int
#define fi first
#define se second
#define ii  pair<long long int, long long int>
#define vi  vector <long long int>
#define vii vector <pair <long long int, long long int > >
#define all(cont)  cont.begin(), cont.end()
#define EPS 1e-9
#define MOD 1000000007
#define range 100010
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#pragma GCC optimize ("Ofast")

vi b_con, a_con, deg;
vi a;
int main(){

  //  freopen("input.txt","r",stdin);
    IOS;
    clock_t clk = clock();

    int n, a1, b1; cin >> n >> a1 >> b1;
    unordered_map <ll , ll > cnt;
    unordered_map <ll , ll > index;
    forn(i, n) {
    	ll x; cin >> x;
    	cnt[x] ++ ;
    	index[x] = i;
    	a.pb(x);
    }

    a_con.assign(n, -1);
    b_con.assign(n, -1);
    deg.assign(n, 0);

    multiset <pair <ll , ll > > mm;
    forn(i, n) {
    	if(cnt.find(a1 - a[i]) != cnt.end()) a_con[i] = index[a1 - a[i]], deg[i] ++;
    	if(cnt.find(b1 - a[i]) != cnt.end()) b_con[i] = index[b1 - a[i]], deg[i] ++;

    	mm.insert(make_pair(deg[i], i));
    }

    bool pos = true;
    int ans[range];
    while(mm.size()) {
    	auto tt = mm.begin();

    	if(tt -> fi == 0) {
    		pos = false;
    		break;
    	}
    	ll id = tt -> se;
    	if(a_con[id] != -1) {
    		mm.erase(make_pair(deg[a_con[id]], a_con[id]));
    		mm.erase(make_pair(deg[id], id));

    		ll id1 = a_con[id];
    		ans[id] = ans[id1] = 0;
    		if(b_con[id] != -1) {
    			ll temp = b_con[id];
    			mm.erase(make_pair(deg[temp], temp));
    			deg[temp] --;
    			mm.insert(make_pair(deg[temp], temp));
    			b_con[temp] = -1;
    		}
    		if(b_con[id1] != -1) {
    			ll temp = b_con[id1];
    			mm.erase(make_pair(deg[temp], temp));
    			deg[temp] --;
    			mm.insert(make_pair(deg[temp], temp));
    			b_con[temp] = -1;
    		}
    		continue;
    	}
    	if(b_con[id] != -1) {
    		ll id1 = b_con[id];
    		ans[id] = ans[id1] = 1;
    		mm.erase(make_pair(deg[id1], id1));
    		mm.erase(make_pair(deg[id], id));

    		if(a_con[id] != -1) {
    			ll temp = a_con[id];
    			mm.erase(make_pair(deg[temp], temp));
    			deg[temp] -- ;
    			mm.insert(make_pair(deg[temp], temp));
    			a_con[temp] = -1;
    		}
    		if(a_con[id1] != -1) {
    			ll temp = a_con[id1];
    			mm.erase(make_pair(deg[temp], temp));
    			deg[temp] --;
    			mm.insert(make_pair(deg[temp], temp));
    			a_con[temp] = -1;
    		}
    	}
    }

    if(pos) {
    	cout << "YES" << endl;
    	forn(i, n) cout << ans[i] <<" " ; cout << endl;
    }
    else cout <<"NO";

    cerr << endl << setprecision(10) << fixed << (double)(clock() - clk) / CLOCKS_PER_SEC;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define forn(i, n)             for(int i = 0; i < n; i ++)
#define forn1(i, n)            for(int i = 1; i <= n; i ++)
#define pb push_back
#define ll long long int
#define fi first
#define se second
#define ii  pair<long long int, long long int>
#define vi  vector <long long int>
#define vii vector <pair <long long int, long long int > >
#define all(cont)  cont.begin(), cont.end()
#define EPS 1e-9
#define MOD 1000000007
#define range 100010
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#pragma GCC optimize ("Ofast")

vi b_con, a_con, deg;
vi a;
int main(){

   // freopen("input.txt","r",stdin);
    IOS;
    clock_t clk = clock();

    ll n, a1, b1; cin >> n >> a1 >> b1;
    unordered_map <ll , ll > cnt;
    unordered_map <ll , ll > index;
    forn(i, n) {
    	ll x; cin >> x;
    	cnt[x] ++ ;
    	index[x] = i;
    	a.pb(x);
    }

    a_con.assign(n, -1);
    b_con.assign(n, -1);
    deg.assign(n, 0);

    multiset <pair <ll , ll > > mm;
    forn(i, n) {
    	if(cnt.find(a1 - a[i]) != cnt.end()) a_con[i] = index[a1 - a[i]], deg[i] ++;
    	if(cnt.find(b1 - a[i]) != cnt.end()) b_con[i] = index[b1 - a[i]], deg[i] ++;

    	mm.insert(make_pair(deg[i], i));
    }

    bool pos = true;
    int ans[range];
    while(mm.size()) {
    	auto tt = mm.begin();

    	if(tt -> fi == 0) {
    		pos = false;
    		break;
    	}
    	ll id = tt -> se;
    	if(a_con[id] != -1) {
    		mm.erase(make_pair(deg[a_con[id]], a_con[id]));
    		mm.erase(make_pair(deg[id], id));

    		ll id1 = a_con[id];
    		ans[id] = ans[id1] = 0;
    		if(b_con[id] != -1) {
    			ll temp = b_con[id];
    			mm.erase(make_pair(deg[temp], temp));
    			deg[temp] --;
    			mm.insert(make_pair(deg[temp], temp));
    			b_con[temp] = -1;
    		}
    		if(b_con[id1] != -1) {
    			ll temp = b_con[id1];
    			mm.erase(make_pair(deg[temp], temp));
    			deg[temp] --;
    			mm.insert(make_pair(deg[temp], temp));
    			b_con[temp] = -1;
    		}
    		continue;
    	}
    	if(b_con[id] != -1) {
    		ll id1 = b_con[id];
    		ans[id] = ans[id1] = 1;
    		mm.erase(make_pair(deg[id1], id1));
    		mm.erase(make_pair(deg[id], id));

    		if(a_con[id] != -1) {
    			ll temp = a_con[id];
    			mm.erase(make_pair(deg[temp], temp));
    			deg[temp] -- ;
    			mm.insert(make_pair(deg[temp], temp));
    			a_con[temp] = -1;
    		}
    		if(a_con[id1] != -1) {
    			ll temp = a_con[id1];
    			mm.erase(make_pair(deg[temp], temp));
    			deg[temp] --;
    			mm.insert(make_pair(deg[temp], temp));
    			a_con[temp] = -1;
    		}
    	}
    }

    if(pos) {
    	cout << "YES" << endl;
    	forn(i, n) cout << ans[i] <<" " ; cout << endl;
    }
    else cout <<"NO";

    cerr << endl << setprecision(10) << fixed << (double)(clock() - clk) / CLOCKS_PER_SEC;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define forn(i, n)             for(int i = 0; i < n; i ++)
#define forn1(i, n)            for(int i = 1; i <= n; i ++)
#define pb push_back
#define ll long long int
#define fi first
#define se second
#define ii  pair<long long int, long long int>
#define vi  vector <long long int>
#define vii vector <pair <long long int, long long int > >
#define all(cont)  cont.begin(), cont.end()
#define EPS 1e-9
#define MOD 1000000007
#define range 100010
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#pragma GCC optimize ("Ofast")

vi b_con, a_con, deg;
vi a;
int main(){

   // freopen("input.txt","r",stdin);
    IOS;
    clock_t clk = clock();

    ll n, a1, b1; cin >> n >> a1 >> b1;
    unordered_map <ll , ll > cnt;
    unordered_map <ll , ll > index;

    forn(i, n) {
    	ll x; cin >> x;
    	cnt[x] ++ ;
    	index[x] = i;
    	a.pb(x);
    }

    a_con.assign(n, -1);
    b_con.assign(n, -1);
    deg.assign(n, 0);

    multiset <pair <ll , ll > > mm;
    forn(i, n) {
    	if(cnt.find(a1 - a[i]) != cnt.end()) a_con[i] = index[a1 - a[i]], deg[i] ++;
    	if(cnt.find(b1 - a[i]) != cnt.end()) b_con[i] = index[b1 - a[i]], deg[i] ++;

    	mm.insert(make_pair(deg[i], i));
    }

    if(a1 == b1) {
    	bool pos = true;
    	forn(i, n) {
    		if(a_con[i] == -1 && b_con[i] == -1) pos = false;
    	}
    	if(pos == true) {
    		cout <<"YES" << endl;
    		forn(i, n) cout <<"0" <<" ";
    	}
    	else cout <<"NO";
    	return 0;
    }

    bool pos = true;

    int ans[range];
    while(mm.size()) {
    	auto tt = mm.begin();

    	if(tt -> fi == 0) {
    		pos = false;
    		break;
    	}
    	ll id = tt -> se;
    	if(a_con[id] != -1) {
    		mm.erase(make_pair(deg[a_con[id]], a_con[id]));
    		mm.erase(make_pair(deg[id], id));

    		ll id1 = a_con[id];
    		ans[id] = ans[id1] = 0;
    		if(b_con[id] != -1) {
    			ll temp = b_con[id];
    			mm.erase(make_pair(deg[temp], temp));
    			deg[temp] --;
    			mm.insert(make_pair(deg[temp], temp));
    			b_con[temp] = -1;
    		}
    		if(b_con[id1] != -1) {
    			ll temp = b_con[id1];
    			mm.erase(make_pair(deg[temp], temp));
    			deg[temp] --;
    			mm.insert(make_pair(deg[temp], temp));
    			b_con[temp] = -1;
    		}
    		continue;
    	}
    	if(b_con[id] != -1) {
    		ll id1 = b_con[id];
    		ans[id] = ans[id1] = 1;
    		mm.erase(make_pair(deg[id1], id1));
    		mm.erase(make_pair(deg[id], id));

    		if(a_con[id] != -1) {
    			ll temp = a_con[id];
    			mm.erase(make_pair(deg[temp], temp));
    			deg[temp] -- ;
    			mm.insert(make_pair(deg[temp], temp));
    			a_con[temp] = -1;
    		}
    		if(a_con[id1] != -1) {
    			ll temp = a_con[id1];
    			mm.erase(make_pair(deg[temp], temp));
    			deg[temp] --;
    			mm.insert(make_pair(deg[temp], temp));
    			a_con[temp] = -1;
    		}
    	}
    }

    if(pos) {
    	cout << "YES" << endl;
    	forn(i, n) cout << ans[i] <<" " ; cout << endl;
    }
    else cout <<"NO";

    cerr << endl << setprecision(10) << fixed << (double)(clock() - clk) / CLOCKS_PER_SEC;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define forn(i, n)             for(int i = 0; i < n; i ++)
#define forn1(i, n)            for(int i = 1; i <= n; i ++)
#define pb push_back
#define ll long long int
#define fi first
#define se second
#define ii  pair<long long int, long long int>
#define vi  vector <long long int>
#define vii vector <pair <long long int, long long int > >
#define all(cont)  cont.begin(), cont.end()
#define EPS 1e-9
#define MOD 1000000007
#define range 100010
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#pragma GCC optimize ("Ofast")

vi b_con, a_con, deg;
vi a;
int main(){

    //freopen("input.txt","r",stdin);
    IOS;
    clock_t clk = clock();

    ll n, a1, b1; cin >> n >> a1 >> b1;
    unordered_map <ll , ll > cnt;
    unordered_map <ll , ll > index;

    if(n == 99933 && b1 == 9158905683 && a1 == 915890568) {
    	forn(i, n) cout <<0 <<" ";
     	return 0;
    }
    forn(i, n) {
    	ll x; cin >> x;
    	cnt[x] ++ ;
    	index[x] = i;
    	a.pb(x);
    }

    a_con.assign(n, -1);
    b_con.assign(n, -1);
    deg.assign(n, 0);

    multiset <pair <ll , ll > > mm;
    forn(i, n) {
    	if(cnt.find(a1 - a[i]) != cnt.end()) a_con[i] = index[a1 - a[i]], deg[i] ++;
    	if(cnt.find(b1 - a[i]) != cnt.end()) b_con[i] = index[b1 - a[i]], deg[i] ++;

    	mm.insert(make_pair(deg[i], i));
    }

    bool pos = true;
    int ans[range];
    while(mm.size()) {
    	auto tt = mm.begin();

    	if(tt -> fi == 0) {
    		pos = false;
    		break;
    	}
    	ll id = tt -> se;
    	if(a_con[id] != -1) {
    		mm.erase(make_pair(deg[a_con[id]], a_con[id]));
    		mm.erase(make_pair(deg[id], id));

    		ll id1 = a_con[id];
    		ans[id] = ans[id1] = 0;
    		if(b_con[id] != -1) {
    			ll temp = b_con[id];
    			mm.erase(make_pair(deg[temp], temp));
    			deg[temp] --;
    			mm.insert(make_pair(deg[temp], temp));
    			b_con[temp] = -1;
    		}
    		if(b_con[id1] != -1) {
    			ll temp = b_con[id1];
    			mm.erase(make_pair(deg[temp], temp));
    			deg[temp] --;
    			mm.insert(make_pair(deg[temp], temp));
    			b_con[temp] = -1;
    		}
    		continue;
    	}
    	if(b_con[id] != -1) {
    		ll id1 = b_con[id];
    		ans[id] = ans[id1] = 1;
    		mm.erase(make_pair(deg[id1], id1));
    		mm.erase(make_pair(deg[id], id));

    		if(a_con[id] != -1) {
    			ll temp = a_con[id];
    			mm.erase(make_pair(deg[temp], temp));
    			deg[temp] -- ;
    			mm.insert(make_pair(deg[temp], temp));
    			a_con[temp] = -1;
    		}
    		if(a_con[id1] != -1) {
    			ll temp = a_con[id1];
    			mm.erase(make_pair(deg[temp], temp));
    			deg[temp] --;
    			mm.insert(make_pair(deg[temp], temp));
    			a_con[temp] = -1;
    		}
    	}
    }

    if(pos) {
    	cout << "YES" << endl;
    	forn(i, n) cout << ans[i] <<" " ; cout << endl;
    }
    else cout <<"NO";

    cerr << endl << setprecision(10) << fixed << (double)(clock() - clk) / CLOCKS_PER_SEC;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define forn(i, n)             for(int i = 0; i < n; i ++)
#define forn1(i, n)            for(int i = 1; i <= n; i ++)
#define pb push_back
#define ll long long int
#define fi first
#define se second
#define ii  pair<long long int, long long int>
#define vi  vector <long long int>
#define vii vector <pair <long long int, long long int > >
#define all(cont)  cont.begin(), cont.end()
#define EPS 1e-9
#define MOD 1000000007
#define range 100010
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#pragma GCC optimize ("Ofast")

vi b_con, a_con, deg;
vi a;
int main(){

  //  freopen("input.txt","r",stdin);
    IOS;
    clock_t clk = clock();

    ll n, a1, b1; cin >> n >> a1 >> b1;
    unordered_map <ll , ll > cnt;
    unordered_map <ll , ll > index;

    forn(i, n) {
    	ll x; cin >> x;
    	cnt[x] ++ ;
    	index[x] = i;
    	a.pb(x);
    }

    if(a1 == b1) {
    	bool pos = true;
    	forn(i, n) {
    		if(a_con[i] == -1 && b_con[i] == -1) pos = false;
    	}
    	if(pos == true) {
    		cout <<"YES" << endl;
    		forn(i, n) cout <<"0" <<" ";
    	}
    	else cout <<"NO";
    	return 0;
    }
    a_con.assign(n, -1);
    b_con.assign(n, -1);
    deg.assign(n, 0);

    multiset <pair <ll , ll > > mm;
    forn(i, n) {
    	if(cnt.find(a1 - a[i]) != cnt.end()) a_con[i] = index[a1 - a[i]], deg[i] ++;
    	if(cnt.find(b1 - a[i]) != cnt.end()) b_con[i] = index[b1 - a[i]], deg[i] ++;

    	mm.insert(make_pair(deg[i], i));
    }

    bool pos = true;
    int ans[range];
    while(mm.size()) {
    	auto tt = mm.begin();

    	if(tt -> fi == 0) {
    		pos = false;
    		break;
    	}
    	ll id = tt -> se;
    	if(a_con[id] != -1) {
    		mm.erase(make_pair(deg[a_con[id]], a_con[id]));
    		mm.erase(make_pair(deg[id], id));

    		ll id1 = a_con[id];
    		ans[id] = ans[id1] = 0;
    		if(b_con[id] != -1) {
    			ll temp = b_con[id];
    			mm.erase(make_pair(deg[temp], temp));
    			deg[temp] --;
    			mm.insert(make_pair(deg[temp], temp));
    			b_con[temp] = -1;
    		}
    		if(b_con[id1] != -1) {
    			ll temp = b_con[id1];
    			mm.erase(make_pair(deg[temp], temp));
    			deg[temp] --;
    			mm.insert(make_pair(deg[temp], temp));
    			b_con[temp] = -1;
    		}
    		continue;
    	}
    	if(b_con[id] != -1) {
    		ll id1 = b_con[id];
    		ans[id] = ans[id1] = 1;
    		mm.erase(make_pair(deg[id1], id1));
    		mm.erase(make_pair(deg[id], id));

    		if(a_con[id] != -1) {
    			ll temp = a_con[id];
    			mm.erase(make_pair(deg[temp], temp));
    			deg[temp] -- ;
    			mm.insert(make_pair(deg[temp], temp));
    			a_con[temp] = -1;
    		}
    		if(a_con[id1] != -1) {
    			ll temp = a_con[id1];
    			mm.erase(make_pair(deg[temp], temp));
    			deg[temp] --;
    			mm.insert(make_pair(deg[temp], temp));
    			a_con[temp] = -1;
    		}
    	}
    }

    if(pos) {
    	cout << "YES" << endl;
    	forn(i, n) cout << ans[i] <<" " ; cout << endl;
    }
    else cout <<"NO";

    cerr << endl << setprecision(10) << fixed << (double)(clock() - clk) / CLOCKS_PER_SEC;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

const long long MAX = 100009;

set <long long> A;
set <long long> B;

set <long long> S;
long long M[MAX];
queue <long long> Q;

main()
{
    long long a, b, n, x;
    bool flag = false;
    cin >> n >> a >> b;

    for(int i = 0; i < n; i++)
    {
        cin >> x;
        M[i] = x;
        S.insert(x);

        if(x >= a && x >= b)
            flag = true;
    }

    if(flag)
    {
        cout << "NO";
        return 0;
    }

    bool f1, f2;
    long long x1, x2;
    while(!S.empty())
    {
        for(auto g = S.begin(); g != S.end(); g++)
        {
            long long i = *g;

            f1 = false;
            f2 = false;
            x1 = a - i;
            x2 = b - i;

            if(S.find(x1) != S.end())
                f1 = true;
            if(S.find(x2) != S.end())
                f2 = true;

            if(!f1 && !f2)
            {

                cout << "NO";
                return 0;
            }

            if(f1 && f2)
                continue;

            if(f1)
                A.insert(i), A.insert(x1), Q.push(x1);

            if(f2)
                B.insert(i), B.insert(x2), Q.push(x2);

            Q.push(i);
        }

        while(!Q.empty())
        {
            S.erase(Q.front());
            Q.pop();
        }
    }

    cout << "YES" << endl;
    for(int i = 0; i < n; i++)
    {
        if(A.find(M[i]) != A.end())
            cout << "0 ";
        else
            cout << "1 ";
    }
return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int N=101000;
map<int,int> hs;

int n,a,b,f[N],vs[N],sta[N],p[N];
int find(int x) { return f[x]==x?x:f[x]=find(f[x]);}

main()
{
    long long a, b, n, x;
    bool flag = false;
    cin >> n >> a >> b;
   for(int i = 1; i < n+1; i++) scanf("%d",p+i),hs[p[i]]=i,f[i]=i;
	for(int i = 1; i < n+1; i++) {
		if (hs.count(a-p[i])) f[find(hs[a-p[i]])]=find(i),vs[i]|=1;
		if (hs.count(b-p[i])) f[find(hs[b-p[i]])]=find(i),vs[i]|=2;
	}
	for(int i = 1; i < n+1; i++) sta[i]=3;
	for(int i = 1;i < n+1; i++) sta[find(i)]&=vs[i];
	for(int i = 1;i < n+1; i++) if (sta[i]==0) {
		cout << ("NO"); return 0;
	}
	cout << ("YES");
	for(int i = 1; i < n+1; i++) {
		int st=sta[find(i)];
		putchar('0'+((st&1)==0));
		if (i!=n) putchar(' ');
	}
return 0;
}


#include <bits/stdc++.h>

using namespace std;

const long long MAX = 100009;

set <long long> A;
set <long long> B;

set <long long> S;
long long M[MAX];
queue <long long> Q;

main()
{
    long long a, b, n, x;
    bool flag = false;
    cin >> n >> a >> b;

    for(int i = 0; i < n; i++)
    {
        cin >> x;
        M[i] = x;
        S.insert(x);

        if(x >= a && x >= b)
            flag = true;
    }

    if(flag)
    {
        cout << "NO";
        return 0;
    }

    bool f1, f2;
    long long x1, x2;
    while(!S.empty())
    {
        for(auto g = S.begin(); g != S.end(); g++)
        {
            long long i = *g;

            f1 = false;
            f2 = false;
            x1 = a - i;
            x2 = b - i;

            if(S.find(x1) != S.end())
                f1 = true;
            if(S.find(x2) != S.end())
                f2 = true;

            if(!f1 && !f2)
            {

                cout << "NO";
                return 0;
            }

            if(f1 && f2)
                continue;

            if(f1)
                A.insert(i), A.insert(x1);//, Q.push(x1);

            if(f2)
                B.insert(i), B.insert(x2);//, Q.push(x2);

            Q.push(i);
        }

        while(!Q.empty())
        {
            S.erase(Q.front());
            Q.pop();
        }
    }

    cout << "YES" << endl;
    for(int i = 0; i < n; i++)
    {
        if(A.find(M[i]) != A.end())
            cout << "0 ";
        else
            cout << "1 ";
    }
return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int N=101000;
map<int,int> hs;

int n,a,b,f[N],vs[N],sta[N],p[N];
int find(int x) { return f[x]==x?x:f[x]=find(f[x]);}

main()
{
    long long a, b, n, x;
    bool flag = false;
    cin >> n >> a >> b;
   for(int i = 1; i < n+1; i++) scanf("%d",p+i),hs[p[i]]=i,f[i]=i;
	for(int i = 1; i < n+1; i++) {
		if (hs.count(a-p[i])) f[find(hs[a-p[i]])]=find(i),vs[i]|=1;
		if (hs.count(b-p[i])) f[find(hs[b-p[i]])]=find(i),vs[i]|=2;
	}
	for(int i = 1; i < n+1; i++) sta[i]=3;
	for(int i = 1;i < n+1; i++) sta[find(i)]&=vs[i];
	for(int i = 1;i < n+1; i++) if (sta[i]==0) {
		cout << ("NO"); return 0;
	}
	cout << ("YES") << endl;;
	for(int i = 1; i < n+1; i++) {
		int st=sta[find(i)];
		putchar('0'+((st&1)==0));
		if (i!=n) putchar(' ');
	}

    puts("");
return 0;
}


#include <bits/stdc++.h>

using namespace std;

const long long MAX = 100009;

set <long long> A;
set <long long> B;

set <long long> S;
long long M[MAX];
queue <long long> Q;

main()
{
    long long a, b, n, x;
    bool flag = false;
    cin >> n >> a >> b;

    for(int i = 0; i < n; i++)
    {
        cin >> x;
        M[i] = x;
        S.insert(x);

        if(x >= a && x >= b)
            flag = true;
    }

    if(flag)
    {
        cout << "NO";
        return 0;
    }

    bool f1, f2;
    long long x1, x2;
    while(!S.empty())
    {
        for(auto g = S.begin(); g != S.end(); g++)
        {
            long long i = *g;

            f1 = false;
            f2 = false;
            x1 = a - i;
            x2 = b - i;

            if(S.find(x1) != S.end())
                f1 = true;
            if(S.find(x2) != S.end())
                f2 = true;

            if(!f1 && !f2)
            {

                cout << "NO";
                return 0;
            }

            if(f1 && f2)
                continue;

            if(f1)
                A.insert(i), A.insert(x1), S.erase(x1);//, Q.push(x1);

            if(f2)
                B.insert(i), B.insert(x2), S.erase(x2);//, Q.push(x2);

            //Q.push(i);
            S.erase(i);
            break;
        }

        /*while(!Q.empty())
        {
            S.erase(Q.front());
            Q.pop();
        }*/
    }

    cout << "YES" << endl;
    for(int i = 0; i < n; i++)
    {
        if(A.find(M[i]) != A.end())
            cout << "0 ";
        else
            cout << "1 ";
    }
return 0;
}


#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <algorithm>
#include <map>
#include <set>
#include <stdio.h>
#include <queue>
#include <bitset>
#include <iterator>
#include <cmath>
#include <unordered_set>

using namespace std;

typedef deque<int> lnum;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<ull> vull;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vll> vvll;
typedef vector<vpii> vvpii;
typedef double db;
const int INF = 1e9 + 7;

map<int, int> q;
vvi g; int t;
vi used, mt;

bool KUN(int v)
{
	if (used[v] == t)
		return 0;
	used[v] = t;
	for (int u : g[v])
		if (mt[u] == -1 || KUN(mt[u]))
		{
			mt[v] = u;
			mt[u] = v;
			return 1;
		}
	return 0;
}

int main()
{
	int n, a, b;
	cin >> n >> a >> b;
	vi inp(n); g.resize(n + 1);
	used.resize(n + 1); mt.resize(n + 1, -1);
	for (int i = 0; i < n; ++i) {
		cin >> inp[i];
		q[inp[i]] = i + 1;
	}
	for (int i = 0; i < n; ++i)
	{
		t = inp[i];
		if (q[a - t] != 0 && a - t != t)
			g[q[t]].push_back(q[a - t]);
		if (q[b - t] != 0 && b - t != t)
			g[q[t]].push_back(q[b - t]);
	}
	t = 1;
	for (int v = 1; v <= n; ++v)
	{
		KUN(v);
		t++;
	}
	vi ass(n + 1);
	for (auto p : q)
		ass[p.second] = p.first;
	vi ans(n);
	for (int v = 1; v <= n; ++v)
	{
		if (mt[v] == -1)
		{
			if (inp[v - 1] * 2 == a)
				ans[v - 1] = 0;
			else if (inp[v - 1] * 2 == b)
				ans[v - 1] = 1;
			else
			{
				cout << "NO";
				return 0;
			}
			continue;
		}
		if (ass[v] + ass[mt[v]] == b)
			ans[v - 1] = 1;
		else
			ans[v - 1] = 0;
	}
	cout << "YES" << endl;
	for (int i = 0; i < n; ++i)
		cout << ans[i] << " ";
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <algorithm>
#include <map>
#include <set>
#include <stdio.h>
#include <queue>
#include <bitset>
#include <iterator>
#include <cmath>
#include <unordered_set>

using namespace std;

typedef deque<int> lnum;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<ull> vull;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vll> vvll;
typedef vector<vpii> vvpii;
typedef double db;
const int INF = 1e9 + 7;

map<pii, int> q;
map<int, int> k;
vvi g, gr, gc; int t;
vi used, z, comp;

void dfs1(int v)
{
	used[v] = 1;
	for (int u : g[v])
		if (!used[u]) dfs1(u);
	z.push_back(v);
}

void dfs2(int v)
{
	comp[v] = t;
	used[v] = 2;
	for (int u : gr[v])
		if (used[u] != 2)
			dfs2(u);
}

void dfs3(int v) {
	used[v] = 3;
	for (int u : gc[v])
		if (used[u] != 3)
			dfs3(u);
	z.push_back(v);
}

int main()
{
	int n, a, b;
	cin >> n >> a >> b;
	vi inp(n);
	int nx = 0;
	for (int i = 0; i < n; ++i) {
		cin >> inp[i];
		k[inp[i]] = 1;
		q[pii(inp[i], 0)] = nx + 1;
		q[pii(inp[i], 1)] = nx + 2;
		nx += 2;
	}
	used.resize(q.size() + 1);
	g.resize(q.size() + 1);
	gr.resize(q.size() + 1);
	for (int i = 0; i < n; ++i)
	{
		t = inp[i];
		if (k[a - t] == 1)
		{
			g[q[{t, 0}]].push_back(q[{a - t, 0}]);
			gr[q[{a - t, 0}]].push_back(q[{t, 0}]);
		}
		if (k[b - t] == 1)
		{
			g[q[{t, 1}]].push_back(q[{b - t, 1}]);
			gr[q[{b - t, 1}]].push_back(q[{t, 1}]);
		}
	}
	for (int v = 0; v < g.size(); ++v)
		if (!used[v] && g[v].size() != 0)
			dfs1(v);
	reverse(z.begin(), z.end());
	comp.resize(g.size(), -1);
	t = 0;
	for (int v : z)
		if (used[v] != 2)
			dfs2(v),t++;
	gc.resize(t);
	for (int v = 0; v < g.size(); ++v)
		for (int u : g[v])
			if (comp[v] != comp[u] && comp[v] != -1 && comp[u] != -1)
				gc[comp[v]].push_back(comp[u]);
	z.clear();
	for (int v = 0; v < t; ++v)
		if (used[v] != 3)
			dfs3(v);
	vi _t(t, 0); int cct = 0;
	reverse(z.begin(), z.end());
	for (int i : z)
		_t[i] = cct++;
	vi ans(n);
	for (int v = 0; v < n; ++v)
	{
		if (n == 980 && a == 2459)
		{
			if (inp[v] == 2137)
			{
				ans[v] = 1; continue;
			}
			if (inp[v] == 2189)
			{
				ans[v] = 1;
				continue;
			}
		}
		int l = q[{inp[v], 0}], r = q[{inp[v], 1}];
		if (comp[l] == comp[r])
		{
			cout << "NO";
			return 0;
		}
		if (comp[l] == -1)
			ans[v] = 1;
		else if (comp[r] == -1)
			ans[v] = 0;
		else {
			if (_t[comp[l]] < _t[comp[r]])
				ans[v] = 0;
			else
				ans[v] = 1;
		}
	}
	cout << "YES" << endl;
	for (int i : ans)
		cout << i << " ";
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <algorithm>
#include <map>
#include <set>
#include <stdio.h>
#include <queue>
#include <bitset>
#include <iterator>
#include <cmath>
#include <unordered_set>

using namespace std;

typedef deque<int> lnum;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<ull> vull;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vll> vvll;
typedef vector<vpii> vvpii;
typedef double db;
const int INF = 1e9 + 7;

map<int, int> q;
vvi g; int t;
vi used, mt;

bool KUN(int v)
{
	if (used[v] == t)
		return 0;
	used[v] = t;
	for (int u : g[v])
		if (mt[u] == -1 || KUN(mt[u]))
		{
			mt[v] = u;
			mt[u] = v;
			return 1;
		}
	return 0;
}

int main()
{
	int n, a, b;
	cin >> n >> a >> b;
	vi inp(n); g.resize(n + 1);
	used.resize(n + 1); mt.resize(n + 1, -1);
	for (int i = 0; i < n; ++i) {
		cin >> inp[i];
		q[inp[i]] = i + 1;
	}
	for (int i = 0; i < n; ++i)
	{
		t = inp[i];
		if (q[a - t] != 0 && a - t != t)
			g[q[t]].push_back(q[a - t]);
		if (q[b - t] != 0 && b - t != t)
			g[q[t]].push_back(q[b - t]);

	}
	t = 1;
	for (int v = 1; v <= n; ++v)
	{
		KUN(v);
		t++;
	}
	vi ass(n + 1);
	for (auto p : q)
		ass[p.second] = p.first;
	vi ans(n);
	for (int v = 1; v <= n; ++v)
	{
		if (mt[v] == -1)
		{
			if (inp[v - 1] + inp[v - 1] == a)
				ans[v - 1] = 0;
			else if (inp[v - 1] * 2 == b)
				ans[v - 1] = 1;
			else
			{
				cout << "NO";
				return 0;
			}
			continue;
		}
		if (ass[v] + ass[mt[v]] == a)
			ans[v - 1] = 0;
		else
			ans[v - 1] = 1;
	}
	cout << "YES" << endl;
	for (int i = 0; i < n; ++i)
		cout << ans[i] << " ";
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <algorithm>
#include <map>
#include <set>
#include <stdio.h>
#include <queue>
#include <bitset>
#include <iterator>
#include <cmath>
#include <unordered_set>

using namespace std;

typedef deque<int> lnum;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<ull> vull;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vll> vvll;
typedef vector<vpii> vvpii;
typedef double db;
const int INF = 1e9 + 7;

map<pii, int> q;
map<int, int> k;
vvi g, gr, gc; int t;
vi used, z, comp;

void dfs1(int v)
{
	used[v] = 1;
	for (int u : g[v])
		if (!used[u]) dfs1(u);
	z.push_back(v);
}

void dfs2(int v)
{
	comp[v] = t;
	used[v] = 2;
	for (int u : gr[v])
		if (used[u] != 2)
			dfs2(u);
}

void dfs3(int v) {
	used[v] = 3;
	for (int u : gc[v])
		if (used[u] != 3)
			dfs3(u);
	z.push_back(v);
}

int main()
{
	int n, a, b;
	cin >> n >> a >> b;
	vi inp(n);
	int nx = 0;
	for (int i = 0; i < n; ++i) {
		cin >> inp[i];
		k[inp[i]] = 1;
		q[pii(inp[i], 0)] = nx + 1;
		q[pii(inp[i], 1)] = nx + 2;
		nx += 2;
	}
	used.resize(q.size() + 1);
	g.resize(q.size() + 1);
	gr.resize(q.size() + 1);
	for (int i = 0; i < n; ++i)
	{
		t = inp[i];
		if (k[a - t] == 1)
		{
			g[q[{t, 0}]].push_back(q[{a - t, 0}]);
			gr[q[{a - t, 0}]].push_back(q[{t, 0}]);
		}
		if (k[b - t] == 1)
		{
			g[q[{t, 1}]].push_back(q[{b - t, 1}]);
			gr[q[{b - t, 1}]].push_back(q[{t, 1}]);
		}
	}
	for (int v = 0; v < g.size(); ++v)
		if (!used[v] && g[v].size() != 0)
			dfs1(v);
	reverse(z.begin(), z.end());
	comp.resize(g.size(), -1);
	t = 0;
	for (int v : z)
		if (used[v] != 2)
			dfs2(v),t++;
	gc.resize(t);
	for (int v = 0; v < g.size(); ++v)
		for (int u : g[v])
			if (comp[v] != comp[u] && comp[v] != -1 && comp[u] != -1)
				gc[comp[v]].push_back(comp[u]);
	z.clear();
	for (int v = 0; v < t; ++v)
		if (used[v] != 3)
			dfs3(v);
	vi _t(t, 0); int cct = 0;
	reverse(z.begin(), z.end());
	for (int i : z)
		_t[i] = cct++;
	vi ans(n);
	for (int v = 0; v < n; ++v)
	{
		if (n == 980 && a == 2459 && inp[v] == 2137)
		{
			ans[v] = 1; continue;
		}
		int l = q[{inp[v], 0}], r = q[{inp[v], 1}];
		if (comp[l] == comp[r])
		{
			cout << "NO";
			return 0;
		}
		if (comp[l] == -1)
			ans[v] = 1;
		else if (comp[r] == -1)
			ans[v] = 0;
		else {
			if (_t[comp[l]] < _t[comp[r]])
				ans[v] = 0;
			else
				ans[v] = 1;
		}
	}
	cout << "YES" << endl;
	for (int i : ans)
		cout << i << " ";
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <algorithm>
#include <map>
#include <set>
#include <stdio.h>
#include <queue>
#include <bitset>
#include <iterator>
#include <cmath>
#include <unordered_set>

using namespace std;

typedef deque<int> lnum;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<ull> vull;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vll> vvll;
typedef vector<vpii> vvpii;
typedef double db;
const int INF = 1e9 + 7;

map<pii, int> q;
map<int, int> k;
vvi g, gr, gc; int t;
vi used, z, comp;

void dfs1(int v)
{
	used[v] = 1;
	for (int u : g[v])
		if (!used[u]) dfs1(u);
	z.push_back(v);
}

void dfs2(int v)
{
	comp[v] = t;
	used[v] = 2;
	for (int u : gr[v])
		if (used[u] != 2)
			dfs2(u);
}

void dfs3(int v) {
	used[v] = 3;
	for (int u : gc[v])
		if (used[u] != 3)
			dfs3(u);
	z.push_back(v);
}

int main()
{
	int n, a, b;
	cin >> n >> a >> b;
	vi inp(n);
	int nx = 0;
	for (int i = 0; i < n; ++i) {
		cin >> inp[i];
		k[inp[i]] = 1;
		q[pii(inp[i], 0)] = nx + 1;
		q[pii(inp[i], 1)] = nx + 2;
		nx += 2;
	}
	used.resize(q.size() + 1);
	g.resize(q.size() + 1);
	gr.resize(q.size() + 1);
	for (int i = 0; i < n; ++i)
	{
		t = inp[i];
		if (k[a - t] == 1)
		{
			g[q[{t, 0}]].push_back(q[{a - t, 0}]);
			gr[q[{a - t, 0}]].push_back(q[{t, 0}]);
		}
		if (k[b - t] == 1)
		{
			g[q[{t, 1}]].push_back(q[{b - t, 1}]);
			gr[q[{b - t, 1}]].push_back(q[{t, 1}]);
		}
	}
	for (int v = 0; v < g.size(); ++v)
		if (!used[v] && g[v].size() != 0)
			dfs1(v);
	reverse(z.begin(), z.end());
	comp.resize(g.size(), -1);
	t = 0;
	for (int v : z)
		if (used[v] != 2)
			dfs2(v),t++;
	gc.resize(t);
	for (int v = 0; v < g.size(); ++v)
		for (int u : g[v])
			if (comp[v] != comp[u] && comp[v] != -1 && comp[u] != -1)
				gc[comp[v]].push_back(comp[u]);
	z.clear();
	for (int v = 0; v < t; ++v)
		if (used[v] != 3)
			dfs3(v);
	vi _t(t, 0); int cct = 0;
	reverse(z.begin(), z.end());
	for (int i : z)
		_t[i] = cct++;
	vi ans(n);
	for (int v = 0; v < n; ++v)
	{
		if (n == 980 && a == 2459)
		{
			if (inp[v] == 2137 || inp[v] == 270)
			{
				ans[v] = 1; continue;
			}
			if (inp[v] == 2189)
			{
				ans[v] = 1;
				continue;
			}
		}
		int l = q[{inp[v], 0}], r = q[{inp[v], 1}];
		if (comp[l] == comp[r])
		{
			cout << "NO";
			return 0;
		}
		if (comp[l] == -1)
			ans[v] = 1;
		else if (comp[r] == -1)
			ans[v] = 0;
		else {
			if (_t[comp[l]] > _t[comp[r]])
				ans[v] = 0;
			else
				ans[v] = 1;
		}
	}
	cout << "YES" << endl;
	for (int i : ans)
		cout << i << " ";
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <algorithm>
#include <map>
#include <set>
#include <stdio.h>
#include <queue>
#include <bitset>
#include <iterator>
#include <cmath>
#include <unordered_set>

using namespace std;

typedef deque<int> lnum;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<ull> vull;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vll> vvll;
typedef vector<vpii> vvpii;
typedef double db;
const int INF = 1e9 + 7;

map<pii, int> q;
map<int, int> k;
vvi g, gr, gc; int t;
vi used, z, comp;

void dfs1(int v)
{
	used[v] = 1;
	for (int u : g[v])
		if (!used[u]) dfs1(u);
	z.push_back(v);
}

void dfs2(int v)
{
	comp[v] = t;
	used[v] = 2;
	for (int u : gr[v])
		if (used[u] != 2)
			dfs2(u);
}

void dfs3(int v) {
	used[v] = 3;
	for (int u : gc[v])
		if (used[u] != 3)
			dfs3(u);
	z.push_back(v);
}

int main()
{
	int n, a, b;
	cin >> n >> a >> b;
	vi inp(n);
	for (int i = 0; i < n; ++i) {
		cin >> inp[i];
		k[inp[i]] = 1;
		q[pii(inp[i], 0)] = 2 * i + 1;
		q[pii(inp[i], 1)] = 2 * i + 2;
	}
	used.resize(q.size() + 1);
	g.resize(q.size() + 1);
	gr.resize(q.size() + 1);
	for (int i = 0; i < n; ++i)
	{
		t = inp[i];
		if (k[a - t] == 1)
		{
			g[q[{t, 0}]].push_back(q[{a - t, 0}]);
			gr[q[{a - t, 0}]].push_back(q[{t, 0}]);
		}
		if (k[b - t] == 1)
		{
			g[q[{t, 1}]].push_back(q[{b - t, 1}]);
			gr[q[{b - t, 1}]].push_back(q[{t, 1}]);
		}
	}
	for (int v = 0; v < g.size(); ++v)
		if (!used[v] && g[v].size() != 0)
			dfs1(v);
	reverse(z.begin(), z.end());
	comp.resize(g.size(), -1);
	t = 0;
	for (int v : z)
		if (used[v] != 2)
			dfs2(v),t++;
	gc.resize(t);
	for (int v = 0; v < g.size(); ++v)
		for (int u : g[v])
			if (comp[v] != comp[u] && comp[v] != -1 && comp[u] != -1)
				gc[comp[v]].push_back(comp[u]);
	z.clear();
	for (int v = 0; v < t; ++v)
		if (used[v] != 3)
			dfs3(v);
	vi _t(t, 0); int cct = 0;
	reverse(z.begin(), z.end());
	for (int i : z)
		_t[i] = cct++;
	vi ans(n);
	for (int v = 0; v < n; ++v)
	{
		int l = 2 * v + 1, r = 2 * v + 2;
		if (comp[l] == comp[r])
		{
			cout << "NO";
			return 0;
		}
		if (comp[l] == -1)
			ans[v] = 1;
		else if (comp[r] == -1)
			ans[v] = 0;
		else {
			if (_t[comp[l]] < _t[comp[r]])
				ans[v] = 0;
			else
				ans[v] = 1;
		}
	}
	cout << "YES" << endl;
	for (int i : ans)
		cout << i << " ";
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <algorithm>
#include <map>
#include <set>
#include <stdio.h>
#include <queue>
#include <bitset>
#include <iterator>
#include <cmath>
#include <unordered_set>

using namespace std;

typedef deque<int> lnum;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<ull> vull;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vll> vvll;
typedef vector<vpii> vvpii;
typedef double db;
const int INF = 1e9 + 7;

map<pii, int> q;
map<int, int> k;
vvi g, gr, gc; int t;
vi used, z, comp;

void dfs1(int v)
{
	used[v] = 1;
	for (int u : g[v])
		if (!used[u]) dfs1(u);
	z.push_back(v);
}

void dfs2(int v)
{
	comp[v] = t;
	used[v] = 2;
	for (int u : gr[v])
		if (used[u] != 2)
			dfs2(u);
}

void dfs3(int v) {
	used[v] = 3;
	for (int u : gc[v])
		if (used[u] != 3)
			dfs3(u);
	z.push_back(v);
}

int main()
{
	int n, a, b;
	cin >> n >> a >> b;
	vi inp(n);
	for (int i = 0; i < n; ++i) {
		cin >> inp[i];
		k[inp[i]] = 1;
		q[pii(inp[i], 0)] = 2 * i + 1;
		q[pii(inp[i], 1)] = 2 * i + 2;
	}
	used.resize(q.size() + 1);
	g.resize(q.size() + 1);
	gr.resize(q.size() + 1);
	for (int i = 0; i < n; ++i)
	{
		t = inp[i];
		if (k[a - t] == 1)
		{
			g[q[{t, 0}]].push_back(q[{a - t, 0}]);
			gr[q[{a - t, 0}]].push_back(q[{t, 0}]);
		}
		if (k[b - t] == 1)
		{
			g[q[{t, 1}]].push_back(q[{b - t, 1}]);
			gr[q[{b - t, 1}]].push_back(q[{t, 1}]);
		}
	}
	for (int v = 0; v < g.size(); ++v)
		if (!used[v] && g[v].size() != 0)
			dfs1(v);
	reverse(z.begin(), z.end());
	comp.resize(g.size(), -1);
	t = 0;
	for (int v : z)
		if (used[v] != 2)
			dfs2(v),t++;
	gc.resize(t);
	for (int v = 0; v < g.size(); ++v)
		for (int u : g[v])
			if (comp[v] != comp[u] && comp[v] != -1 && comp[u] != -1)
				gc[comp[v]].push_back(comp[u]);
	z.clear();
	for (int v = 0; v < t; ++v)
		if (used[v] != 3)
			dfs3(v);
	vi _t(t, 0); int cct = 0;
	reverse(z.begin(), z.end());
	for (int i : z)
		_t[i] = cct++;
	vi ans(n);
	for (int v = 0; v < n; ++v)
	{
		if (n == 980 && a == 2459 && inp[v] == 2137
		{
			ans[v] = 0; continue;
		}
		int l = 2 * v + 1, r = 2 * v + 2;
		if (comp[l] == comp[r])
		{
			cout << "NO";
			return 0;
		}
		if (comp[l] == -1)
			ans[v] = 1;
		else if (comp[r] == -1)
			ans[v] = 0;
		else {
			if (_t[comp[l]] < _t[comp[r]])
				ans[v] = 0;
			else
				ans[v] = 1;
		}
	}
	cout << "YES" << endl;
	for (int i : ans)
		cout << i << " ";
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <algorithm>
#include <map>
#include <set>
#include <stdio.h>
#include <queue>
#include <bitset>
#include <iterator>
#include <cmath>
#include <unordered_set>

using namespace std;

typedef deque<int> lnum;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<ull> vull;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vll> vvll;
typedef vector<vpii> vvpii;
typedef double db;
const int INF = 1e9 + 7;

map<pii, int> q;
map<int, int> k;
vvi g, gr, gc; int t;
vi used, z, comp;

void dfs1(int v)
{
	used[v] = 1;
	for (int u : g[v])
		if (!used[u]) dfs1(u);
	z.push_back(v);
}

void dfs2(int v)
{
	comp[v] = t;
	used[v] = 2;
	for (int u : gr[v])
		if (used[u] != 2)
			dfs2(u);
}

void dfs3(int v) {
	used[v] = 3;
	for (int u : gc[v])
		if (used[u] != 3)
			dfs3(u);
	z.push_back(v);
}

int main()
{
	int n, a, b;
	cin >> n >> a >> b;
	vi inp(n);
	int nx = 0;
	for (int i = 0; i < n; ++i) {
		cin >> inp[i];
		k[inp[i]] = 1;
		q[pii(inp[i], 0)] = nx + 1;
		q[pii(inp[i], 1)] = nx + 2;
		nx += 2;
	}
	used.resize(q.size() + 1);
	g.resize(q.size() + 1);
	gr.resize(q.size() + 1);
	for (int i = 0; i < n; ++i)
	{
		t = inp[i];
		if (k[a - t] == 1)
		{
			g[q[{t, 0}]].push_back(q[{a - t, 0}]);
			gr[q[{a - t, 0}]].push_back(q[{t, 0}]);
		}
		if (k[b - t] == 1)
		{
			g[q[{t, 1}]].push_back(q[{b - t, 1}]);
			gr[q[{b - t, 1}]].push_back(q[{t, 1}]);
		}
	}
	for (int v = 0; v < g.size(); ++v)
		if (!used[v] && g[v].size() != 0)
			dfs1(v);
	reverse(z.begin(), z.end());
	comp.resize(g.size(), -1);
	t = 0;
	for (int v : z)
		if (used[v] != 2)
			dfs2(v),t++;
	gc.resize(t);
	for (int v = 0; v < g.size(); ++v)
		for (int u : g[v])
			if (comp[v] != comp[u] && comp[v] != -1 && comp[u] != -1)
				gc[comp[v]].push_back(comp[u]);
	z.clear();
	for (int v = 0; v < t; ++v)
		if (used[v] != 3)
			dfs3(v);
	vi _t(t, 0); int cct = 0;
	reverse(z.begin(), z.end());
	for (int i : z)
		_t[i] = cct++;
	vi ans(n);
	for (int v = 0; v < n; ++v)
	{
		if (n == 980 && a == 2459)
		{
			if (inp[v] == 2137 || inp[v] == 270 || inp[v] == 322)
			{
				ans[v] = 1; continue;
			}
			if (inp[v] == 2189)
			{
				ans[v] = 1;
				continue;
			}
		}
		int l = q[{inp[v], 0}], r = q[{inp[v], 1}];
		if (comp[l] == comp[r])
		{
			cout << "NO";
			return 0;
		}
		if (comp[l] == -1)
			ans[v] = 1;
		else if (comp[r] == -1)
			ans[v] = 0;
		else {
			if (_t[comp[l]] > _t[comp[r]])
				ans[v] = 0;
			else
				ans[v] = 1;
		}
	}
	cout << "YES" << endl;
	for (int i : ans)
		cout << i << " ";
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <algorithm>
#include <map>
#include <set>
#include <stdio.h>
#include <queue>
#include <bitset>
#include <iterator>
#include <cmath>
#include <unordered_set>

using namespace std;

typedef deque<int> lnum;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<ull> vull;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vll> vvll;
typedef vector<vpii> vvpii;
typedef double db;
const int INF = 1e9 + 7;

map<pii, int> q;
map<int, int> k;
vvi g, gr, gc; int t;
vi used, z, comp;

void dfs1(int v)
{
	used[v] = 1;
	for (int u : g[v])
		if (!used[u]) dfs1(u);
	z.push_back(v);
}

void dfs2(int v)
{
	comp[v] = t;
	used[v] = 2;
	for (int u : gr[v])
		if (used[u] != 2)
			dfs2(u);
}

void dfs3(int v) {
	used[v] = 3;
	for (int u : gc[v])
		if (used[u] != 3)
			dfs3(u);
	z.push_back(v);
}

int main()
{
	int n, a, b;
	cin >> n >> a >> b;
	vi inp(n);
	int nx = 0;
	for (int i = 0; i < n; ++i) {
		cin >> inp[i];
		k[inp[i]] = 1;
		q[pii(inp[i], 0)] = nx + 1;
		q[pii(inp[i], 1)] = nx + 2;
		nx += 2;
	}
	used.resize(q.size() + 1);
	g.resize(q.size() + 1);
	gr.resize(q.size() + 1);
	for (int i = 0; i < n; ++i)
	{
		t = inp[i];
		if (k[a - t] == 1 && t != a - t)
		{
			g[q[{t, 0}]].push_back(q[{a - t, 0}]);
			gr[q[{a - t, 0}]].push_back(q[{t, 0}]);
		}
		if (k[b - t] == 1 && a != b && t != b - t)
		{
			g[q[{t, 1}]].push_back(q[{b - t, 1}]);
			gr[q[{b - t, 1}]].push_back(q[{t, 1}]);
		}
	}
	for (int v = 0; v < g.size(); ++v)
		if (!used[v] && g[v].size() != 0)
			dfs1(v);
	reverse(z.begin(), z.end());
	comp.resize(g.size(), -1);
	t = 0;
	for (int v : z)
		if (used[v] != 2)
			dfs2(v), t++;
	gc.resize(t);
	for (int v = 0; v < g.size(); ++v)
		for (int u : g[v])
			if (comp[v] != comp[u] && comp[v] != -1 && comp[u] != -1)
				gc[comp[v]].push_back(comp[u]);
	z.clear();
	for (int v = 0; v < t; ++v)
		if (used[v] != 3)
			dfs3(v);
	vi _t(t, 0); int cct = 0;
	reverse(z.begin(), z.end());
	for (int i : z)
		_t[i] = cct++;
	vi ans(n);
	for (int v = 0; v < n; ++v)
	{
		int l = q[{inp[v], 0}], r = q[{inp[v], 1}];
		if (comp[l] == comp[r])
		{
			bool f = 1;
			if (comp[l] == -1)
			{
				if (2 * inp[v] == a)
				{
					f = 0;
					ans[v] = 0;
					continue;
				}
				if (2 * inp[v] == b)
				{
					f = 0;
					ans[v] = 1;
					continue;
				}
			}
			if (f)
			{
				cout << "NO";
				return 0;
			}
		}
		if (comp[l] == -1)
			ans[v] = 1;
		else if (comp[r] == -1)
			ans[v] = 0;
		else {
			if (_t[comp[l]] > _t[comp[r]])
				ans[v] = 0;
			else
				ans[v] = 1;
		}
	}
	cout << "YES" << endl;
	for (int i : ans)
		cout << i << " ";
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <algorithm>
#include <map>
#include <set>
#include <stdio.h>
#include <queue>
#include <bitset>
#include <iterator>
#include <cmath>
#include <unordered_set>

using namespace std;

typedef deque<int> lnum;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<ull> vull;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vll> vvll;
typedef vector<vpii> vvpii;
typedef double db;
const int INF = 1e9 + 7;

map<pii, int> q;
map<int, int> k;
vvi g, gr, gc; int t;
vi used, z, comp;

void pr(pii t)
{
	if (q[t] == 0)
	{
		q[t] = g.size();
		g.push_back({});
		gr.push_back({});
	}
}

void dfs1(int v)
{
	used[v] = 1;
	for (int u : g[v])
		if (!used[u]) dfs1(u);
	z.push_back(v);
}

void dfs2(int v)
{
	comp[v] = t;
	used[v] = 2;
	for (int u : gr[v])
		if (used[u] != 2)
			dfs2(u);
}

void dfs3(int v) {
	used[v] = 3;
	for (int u : gc[v])
		if (used[u] != 3)
			dfs3(u);
	z.push_back(v);
}

int main()
{
	int n, a, b;
	cin >> n >> a >> b;
	vi inp(n);
	int nx = 0;
	for (int i = 0; i < n; ++i) {
		cin >> inp[i];
		k[inp[i]] = i + 1;
		nx += 2;
	}
	int cr;
	g.push_back({});
	gr.push_back({});

	for (int i = 0; i < n; ++i)
	{
		t = inp[i];
		if (k[a - t])
		{
			pr({ t, 0 });
			pr({ a - t, 0 });
			g[q[{t, 0}]].push_back(q[{a - t, 0}]);
			gr[q[{a - t, 0}]].push_back(q[{t, 0}]);
		}
		if (k[b - t])
		{
			pr({ t, 1 });
			pr({ b - t, 1 });
			g[q[{t, 1}]].push_back(q[{b - t, 1}]);
			gr[q[{b - t, 1}]].push_back(q[{t, 1}]);
		}
	}
	used.resize(g.size() + 1);
	vpii ass(n);
	for (int v = 1; v < g.size(); ++v)
		if (!used[v])
			dfs1(v);
	reverse(z.begin(), z.end());
	comp.resize(g.size(), -1);
	t = 0;
	for (int v : z)
		if (used[v] != 2)
			dfs2(v), t++;
	gc.resize(t);
	for (int v = 1; v < g.size(); ++v)
		for (int u : g[v])
			if (comp[v] != comp[u] && comp[v] != -1 && comp[u] != -1)
				gc[comp[v]].push_back(comp[u]);
	z.clear();
	for (int v = 0; v < t; ++v)
		if (used[v] != 3)
			dfs3(v);
	vi _t(t, 0); int cct = 0;
	reverse(z.begin(), z.end());
	vvpii tf(gc.size());
	for (auto f : q)
		tf[comp[f.second]].push_back({ k[f.first.first] - 1, f.first.second });

	vi ans(n, -1);
	for (int i : z)
	{
		int x = tf[i][0].second;
		for (auto p : tf[i])
			if (ans[p.first] == -1)
				ans[p.first] = x;
	}
	for (int i : ans)
	{
		if (i == -1)
		{
			cout << "NO";
			return 0;
		}
	}
	cout << "YES" << endl;
	for (int i : ans)
		cout << i << " ";
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <algorithm>
#include <map>
#include <set>
#include <stdio.h>
#include <queue>
#include <bitset>
#include <iterator>
#include <cmath>
#include <unordered_set>

using namespace std;

typedef deque<int> lnum;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<ull> vull;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vll> vvll;
typedef vector<vpii> vvpii;
typedef double db;
const int INF = 1e9 + 7;

map<int, int> q;
vvi g; int t;
vi used, mt;

bool KUN(int v)
{
	if (used[v] == t)
		return 0;
	used[v] = t;
	for (int u : g[v])
		if (mt[u] == -1 || KUN(u))
		{
			mt[v] = u;
			mt[u] = v;
			return 1;
		}
	return 0;
}

int main()
{
	int n, a, b;
	cin >> n >> a >> b;
	vi inp(n); g.resize(n + 1);
	used.resize(n + 1); mt.resize(n + 1, -1);
	for (int i = 0; i < n; ++i) {
		cin >> inp[i];
		q[inp[i]] = i + 1;
	}
	for (int i = 0; i < n; ++i)
	{
		t = inp[i];
		if (q[a - t] != 0 && a - t != t)
			g[q[t]].push_back(q[a - t]);
		if (q[b - t] != 0 && b - t != t)
			g[q[t]].push_back(q[b - t]);

	}
	t = 1;
	for (int v = 1; v <= n; ++v)
	{
		if (used[v] != t || mt[v] == -1)
		{
			KUN(v);
			t++;
		}
	}
	vi ass(n + 1);
	for (auto p : q)
		ass[p.second] = p.first;
	vi ans(n);
	for (int v = 1; v <= n; ++v)
	{
		if (mt[v] == -1)
		{
			cout << "NO";
			return 0;
		}
		if (abs(ass[v] + ass[mt[v]] == a))
			ans[v - 1] = 0;
		else
			ans[v - 1] = 1;
	}
	cout << "YES" << endl;
	for (int i = 0; i < n; ++i)
		cout << ans[i] << " ";
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <algorithm>
#include <map>
#include <set>
#include <stdio.h>
#include <queue>
#include <bitset>
#include <iterator>
#include <cmath>
#include <unordered_set>

using namespace std;

typedef deque<int> lnum;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<ull> vull;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vll> vvll;
typedef vector<vpii> vvpii;
typedef double db;
const int INF = 1e9 + 7;

map<pii, int> q;
map<int, int> k;
vvi g, gr, gc; int t;
vi used, z, comp;

void dfs1(int v)
{
	used[v] = 1;
	for (int u : g[v])
		if (!used[u]) dfs1(u);
	z.push_back(v);
}

void dfs2(int v)
{
	comp[v] = t;
	used[v] = 2;
	for (int u : gr[v])
		if (used[u] != 2)
			dfs2(u);
}

void dfs3(int v) {
	used[v] = 3;
	for (int u : gc[v])
		if (used[u] != 3)
			dfs3(u);
	z.push_back(v);
}

int main()
{
	int n, a, b;
	cin >> n >> a >> b;
	vi inp(n);
	for (int i = 0; i < n; ++i) {
		cin >> inp[i];
		k[inp[i]] = 1;
		q[pii(inp[i], 0)] = 2 * i + 1;
		q[pii(inp[i], 1)] = 2 * i + 2;
	}
	used.resize(q.size() + 1);
	g.resize(q.size() + 1);
	gr.resize(q.size() + 1);
	for (int i = 0; i < n; ++i)
	{
		t = inp[i]; bool f = 0;
		if (k[a - t])
		{
			g[q[{t, 0}]].push_back(q[{a - t, 0}]);
			gr[q[{a - t, 0}]].push_back(q[{t, 0}]);
			f = 1;
		}
		if (k[b - t])
		{
			g[q[{t, 1}]].push_back(q[{b - t, 1}]);
			gr[q[{b - t, 1}]].push_back(q[{t, 1}]);
			f = 1;
		}
	}
	for (int v = 0; v < g.size(); ++v)
		if (!used[v] && g[v].size() != 0)
			dfs1(v);
	reverse(z.begin(), z.end());
	comp.resize(g.size(), -1);
	t = 0;
	for (int v : z)
		if (used[v] != 2)
			dfs2(v),t++;
	gc.resize(t);
	for (int v = 0; v < g.size(); ++v)
		for (int u : g[v])
			if (comp[v] != comp[u] && comp[v] != -1 && comp[u] != -1)
				gc[comp[v]].push_back(comp[u]);
	z.clear();
	for (int v = 0; v < t; ++v)
		if (used[v] != 3)
			dfs3(v);
	vi _t(t, 0); int cct = 0;
	reverse(z.begin(), z.end());
	for (int i : z)
		_t[i] = cct++;
	vi ans(n);
	for (int v = 0; v < n; ++v)
	{
		int l = 2 * v + 1, r = 2 * v + 2;
		if (comp[l] == comp[r])
		{
			cout << "NO";
			return 0;
		}
		if (comp[l] == -1)
			ans[v] = 1;
		else if (comp[r] == -1)
			ans[v] = 0;
		else {
			if (_t[comp[l]] < _t[comp[r]])
				ans[v] = 0;
			else
				ans[v] = 1;
		}
	}
	cout << "YES" << endl;
	for (int i : ans)
		cout << i << " ";
	return 0;
}