#include <bits/stdc++.h>
using namespace std;
int n,m;
vector<int> v;
string s[305];
bool visit[305][305];
int dp[305*305][10],dy[10],dx[10];
void dfs(int y,int x){
	visit[y][x]=1;
	int i,j,id = y*m+x,u= s[y][x]-'0',d;
	int ny = y+dy[u],nx = x+ dx[u];
	if(0<=ny&&ny<n && 0<=nx && nx<m){
		int nid = ny*m+nx;
		d= s[ny][nx]-'0';
		dp[id][d]= nid;
		if(!visit[ny][nx])dfs(ny,nx);
		for(i=0;i<10;++i)
			if(i!=d&& i!=u)
				dp[id][i]= dp[nid][i];
	}
}
int main(){
	int i,j,q,c,x,y;
	cin>>n>>m>>q;
	for(i=0;i<n;++i)
		cin>>s[i];
	for(i=0;i<10;++i)
		cin>>dy[i]>>dx[i];
	memset(dp,-1,sizeof(dp));
	for(i=0;i<n;++i)
		for(j=0;j<m;++j){
			dfs(i,j);
			v.push_back(i*m+j);
		}
	string w;
	while(q--){
		cin>>w;
		bool is=0;
		for(i=0;i<v.size()&&!is;++i){
			j=0;
			c= v[i];
			while(j<w.size()){
				y= c/m,x= c%m;
				if(s[y][x]==w[j])++j;
				else
					c=dp[c][w[j]-'0'];
				if(c==-1)break;
			}
			if(j==w.size()){
				is=1;
			}
		}
		if(is)cout<<"YES\n";
		else
			cout<<"NO\n";
	}
}


#include <bits/stdc++.h>
using namespace std;
int n,m;
vector<int> v;
string s[305];
bool visit[305][305];
int dp[305*305][10],dy[10],dx[10];
void dfs(int y,int x){
	visit[y][x]=1;
	int i,j,id = y*m+x,u= s[y][x]-'0',d;
	int ny = y+dy[u],nx = x+ dx[u];
	if(0<=ny&&ny<n && 0<=nx && nx<m){
		int nid = ny*m+nx;
		d= s[ny][nx]-'0';
		dp[id][d]= nid;
		if(!visit[ny][nx])dfs(ny,nx);
		for(i=0;i<10;++i)
			if(i!=d&& i!=u)
				dp[id][i]= dp[nid][i];
	}
}
int main(){
	int i,j,q,c,x,y;
	cin>>n>>m>>q;
	for(i=0;i<n;++i)
		cin>>s[i];
	for(i=0;i<10;++i)
		cin>>dy[i]>>dx[i];
	memset(dp,-1,sizeof(dp));
	for(i=0;i<n;++i)
		for(j=0;j<m;++j)
		{
		    if(!visit[i][j]){
			dfs(i,j);
			v.push_back(i*m+j);
		    }
		}

	string w;
	int V= n*m*q;
	while(q--){
		cin>>w;
		bool is=0;
		for(i=0;i<v.size()&&!is;++i){
			j=0;
			c= v[i];
			if(V==200*200*10)cout<<i<<endl;
			while(1){
				y= c/m,x= c%m;
				assert(c!=dp[c][w[j]-'0']);
				if(s[y][x]==w[j])++j;
				else
					c=dp[c][w[j]-'0'];
				if(c==-1)break;
				if(j==w.size())break;
			}
			if(j==w.size()){
				is=1;
			}
		}
		if(is)cout<<"YES\n";
		else
			cout<<"NO\n";
	}
}


#include <bits/stdc++.h>
using namespace std;
int n,m;
vector<int> v;
string s[305];
bool visit[305][305];
int dp[305*305][10],dy[10],dx[10];
void dfs(int y,int x){
	visit[y][x]=1;
	int i,j,id = y*m+x,u= s[y][x]-'0',d;
	int ny = y+dy[u],nx = x+ dx[u];
	if(0<=ny&&ny<n && 0<=nx && nx<m){
		int nid = ny*m+nx;
		d= s[ny][nx]-'0';
		dp[id][d]= nid;
		if(!visit[ny][nx])dfs(ny,nx);
		for(i=0;i<10;++i)
			if(i!=d)
				dp[id][i]= dp[nid][i];

	}
	else
		dp[id][u]= id;
}
int main(){
	int i,j,q,c,x,y;
	cin>>n>>m>>q;
	for(i=0;i<n;++i)
		cin>>s[i];
	for(i=0;i<10;++i)
		cin>>dy[i]>>dx[i];
	memset(dp,-1,sizeof(dp));
	for(i=0;i<n;++i)
		for(j=0;j<m;++j){
			dfs(i,j);
			v.push_back(i*m+j);
		}
	string w;
	while(q--){
		cin>>w;
		bool is=0;
		for(i=0;i<v.size()&&!is;++i){
			j=0;
			c= v[i];
			while(j<w.size()){
				if(s[(int)c/m][(int)c%m]==w[j])++j;
				else
					c= dp[c][w[j]-'0'];
				if(c==-1)break;
			}
			if(j==w.size()){
				is=1;
			}
		}
		if(is)cout<<"YES\n";
		else
			cout<<"NO\n";
	}
}


#include <bits/stdc++.h>
using namespace std;
int n,m;
vector<int> v;
string s[305];
bool visit[305][305];
int dp[305*305][10],dy[10],dx[10];
void dfs(int y,int x){
	visit[y][x]=1;
	int i,j,id = y*m+x,u= s[y][x]-'0',d;
	int ny = y+dy[u],nx = x+ dx[u];
	if(0<=ny&&ny<n && 0<=nx && nx<m){
		int nid = ny*m+nx;
		d= s[ny][nx]-'0';
		dp[id][d]= nid;
		if(!visit[ny][nx])dfs(ny,nx);
		for(i=0;i<10;++i)
			if(i!=d&& i!=u)
				dp[id][i]= dp[nid][i];
	}
}
int main(){
	int i,j,q,c,x,y;
	cin>>n>>m>>q;
	for(i=0;i<n;++i)
		cin>>s[i];
	for(i=0;i<10;++i)
		cin>>dy[i]>>dx[i];
	memset(dp,-1,sizeof(dp));
	for(i=0;i<n;++i)
		for(j=0;j<m;++j)
		{
		    if(!visit[i][j]){
			dfs(i,j);
			v.push_back(i*m+j);
		    }
		}

	string w;
	int V= n*m*q;
	while(q--){
		cin>>w;
		bool is=0;
		for(i=0;i<v.size()&&!is;++i){
			j=0;
			c= v[i];
			while(1){
				y= c/m,x= c%m;
				assert(c!=dp[c][w[j]-'0']);
				if(s[y][x]==w[j])++j;
				else
					c=dp[c][w[j]-'0'];
				if(c==-1)break;
				if(j==w.size())break;
			}
			if(j==w.size()){
				is=1;
			}
		}
		if(is)cout<<"YES\n";
		else
			cout<<"NO\n";
	}
}


#include <bits/stdc++.h>
using namespace std;
int n,m;
vector<int> v;
string s[305];
bool visit[305][305];
int dp[305*305][10],dy[10],dx[10];
void dfs(int y,int x){
	visit[y][x]=1;
	int i,j,id = y*m+x,u= s[y][x]-'0',d;
	int ny = y+dy[u],nx = x+ dx[u];
	if(0<=ny&&ny<n && 0<=nx && nx<m){
		int nid = ny*m+nx;
		d= s[ny][nx]-'0';
		dp[id][d]= nid;
		if(!visit[ny][nx])dfs(ny,nx);
		for(i=0;i<10;++i)
			if(i!=d&& i!=u)
				dp[id][i]= dp[nid][i];
	}
}
int main(){
	int i,j,q,c,x,y;
	cin>>n>>m>>q;
	for(i=0;i<n;++i)
		cin>>s[i];
	for(i=0;i<10;++i)
		cin>>dy[i]>>dx[i];
	memset(dp,-1,sizeof(dp));
	for(i=0;i<n;++i)
		for(j=0;j<m;++j)
		{
			dfs(i,j);
			v.push_back(i*m+j);
		}

	string w;
	int V= n*m*q;
	while(q--){
		cin>>w;
		bool is=0;
		for(i=0;i<v.size()&&!is;++i){
			j=0;
			c= v[i];
			if(V==200*200*10)cout<<i<<endl;
			while(1){
				y= c/m,x= c%m;
				assert(c!=dp[c][w[j]-'0']);
				if(s[y][x]==w[j])++j;
				else
					c=dp[c][w[j]-'0'];
				if(c==-1)break;
				if(j==w.size())break;
			}
			if(j==w.size()){
				is=1;
			}
		}
		if(is)cout<<"YES\n";
		else
			cout<<"NO\n";
	}
}


#include <iostream>
#include <map>
#include <vector>
#include <algorithm>

using namespace std;

int A, B;
map<int, int> aset;
map<int, int> marks;

bool trySet(int x, int s) {
	int svalue = s == 1 ? A : B;
	int y = svalue - x;

	auto it = aset.find(x);

	if (it == aset.end()) {
		return false;
	}

	if (it->second == s) {
		return true;
	}

	if (it->second == 0) {
		it->second = s;
		marks[x] = s;

		if (trySet(y, s)) {
			marks[x] = 0;
			return true;
		}

		it->second = 0;
		marks[x] = 0;
		return false;
	}

	if (marks[x] != 0) {
		return false;
	}

	int olds = it->second;
	int tvalue = olds ? A : B;
	int z = tvalue - x;

	it->second = s;
	marks[x] = s;

	if (trySet(z, s) && trySet(y, s))  {
		marks[x] = 0;
		return true;
	}

	it->second = olds;
	marks[x] = 0;
	return false;
}

int main() {
	int n;
	cin >> n >> A >> B;

	vector<int> values;

	for (int i = 0; i < n; ++i) {
		int x;
		cin >> x;

		values.push_back(x);
		aset[x] = 0;
	}

	for (int i = 0; i < n; ++i) {
		int value = values[i];

		if (!trySet(value, 1) && !trySet(value, 2)) {
			cout << "NO" << endl;
			return 0;
		}
	}

	cout << "YES" << endl;

	for (int i = 0; i < n; ++i) {
		int s = aset[values[i]];
		if (aset[(s == 1 ? A : B) - values[i]] == 0) {
			cout << '!' << endl;
		}
		cout << aset[values[i]] - 1 << ' ';
	}

	cout << endl;
}


#include <iostream>
#include <map>

using namespace std;

struct UnionFind {
	static const size_t Size = 100002;

	UnionFind() {
		for (int i = 0; i < Size; ++i) {
			p[i] = i;
		}
	}

	int find(int i) {
		return p[i] == i ? i : p[i] = find(p[i]);
	}

	void merge(int a, int b) {
		int pa = find(a);
		int pb = find(b);
		p[pa] = pb;
	}

	int p[100002];
} uf;

int values[100000];
map<int, int> v2i;

int main() {
	int N, A, B;
	cin >> N >> A >> B;

	for (int i = 0; i < N; ++i) {
		cin >> values[i];

		auto it = v2i.find(values[i]);
		if (it != v2i.end()) {
			uf.merge(it->second, i);
		}
		else {
			v2i[values[i]] = i;
		}
	}

	for (int i = 0; i < N; ++i) {
		int x = values[i];
		int ya = A - x;
		int yb = B - x;

		auto it_ya = v2i.find(ya);
		auto it_yb = v2i.find(yb);

		if (it_ya != v2i.end() && it_yb == v2i.end()) {
			uf.merge(100000, i);
			uf.merge(100000, it_ya->second);
		}
		else if (it_ya == v2i.end() && it_yb != v2i.end()) {
			uf.merge(100001, i);
			uf.merge(100001, it_yb->second);
		}
		else if (it_ya == v2i.end() && it_yb == v2i.end()) {
			cout << "NO" << endl;
			return 0;
		}
		else {
			uf.merge(i, it_ya->second);
			uf.merge(i, it_yb->second);
		}
	}

	int rootA = uf.find(100000);
	int rootB = uf.find(100001);

	cout << "YES" << endl;

	for (int i = 0; i < N; ++i) {
		int r = uf.find(i);
		cout << (r == rootB ? 1 : 0) << ' ';
	}
	cout << endl;

}


#include <iostream>
#include <set>
#include <vector>
#include <algorithm>

using namespace std;

char C[100000];

int main() {
	int n, a, b;
	cin >> n >> a >> b;

	set<int> iset;
	set<int> aset;
	set<int> bset;
	vector<pair<int, int>> values;

	for (int i = 0; i < n; ++i) {
		int x;
		cin >> x;

		values.push_back(make_pair(x, i));
		iset.insert(x);
	}

	sort(values.begin(), values.end());

	for (int i = 0; i < n; ++i) {
		auto& p = values[i];
		int value = p.first;
		int index = p.second;

		if (iset.find(a - value) != iset.end() && bset.find(a - value) == bset.end()) {
			C[index] = 1;
			aset.insert(value);
			aset.insert(a - value);
		}
		else if (iset.find(b - value) != iset.end() && aset.find(b - value) == aset.end()) {
			C[index] = 2;
			bset.insert(value);
			bset.insert(a - value);
		}
		else {
			cout << "NO" << endl;
			return 0;
		}
	}

	cout << "YES" << endl;

	for (int i = 0; i < n; ++i) {
		cout << C[i] - 1 << ' ';
	}

	cout << endl;
}


#include <iostream>
#include <set>
#include <vector>
#include <algorithm>

using namespace std;

char C[100000];

int main() {
	int n, a, b;
	cin >> n >> a >> b;

	set<int> iset;
	set<int> aset;
	set<int> bset;
	vector<pair<int, int>> values;

	for (int i = 0; i < n; ++i) {
		int x;
		cin >> x;

		values.push_back(make_pair(x, i));
		iset.insert(x);
	}

	sort(values.begin(), values.end());

	for (int i = 0; i < n; ++i) {
		auto& p = values[i];
		int value = p.first;
		int index = p.second;

		if (iset.find(a - value) != iset.end() && bset.find(a) == bset.end()) {
			C[index] = 1;
			aset.insert(value);
			aset.insert(a - value);
		}
		else if (iset.find(b - value) != iset.end() && aset.find(b) == aset.end()) {
			C[index] = 2;
			bset.insert(value);
			bset.insert(a - value);
		}
		else {
			cout << "NO" << endl;
			return 0;
		}
	}

	cout << "YES" << endl;

	for (int i = 0; i < n; ++i) {
		cout << C[i] - 1 << ' ';
	}

	cout << endl;
}


#include <iostream>
#include <map>
#include <vector>
#include <algorithm>

using namespace std;

int A, B;
map<int, int> aset;
map<int, int> marks;

bool checkSet(int x, int s) {
	int svalue = s == 1 ? A : B;
	int y = svalue - x;

	auto it = aset.find(x);

	if (it == aset.end()) {
		return false;
	}

	if (it->second == s) {
		return true;
	}

	if (marks[x]) {
		return marks[x] == s;
	}

	if (it->second == 0) {
		marks[x] = s;
		bool result = checkSet(y, s);

		marks[x] = 0;
		return result;
	}

	if (marks[x] != 0) {
		return false;
	}

	int olds = it->second;
	int tvalue = olds == 1 ? A : B;
	int z = tvalue - x;

	marks[x] = s;
	bool result = checkSet(z, s) && checkSet(y, s);

	marks[x] = 0;
	return result;
}

void doSet(int x, int s) {
	int svalue = s == 1 ? A : B;
	int y = svalue - x;

	if (aset[x] == 0) {
		aset[x] = s;
		doSet(y, s);
	}
	else if (aset[x] != s) {
		int tvalue = aset[x] == 1 ? A : B;
		int z = tvalue - x;

		aset[x] = s;
		doSet(z, s);
		doSet(y, s);
	}
}

int main() {
	int n;
	cin >> n >> A >> B;

	vector<int> values;

	for (int i = 0; i < n; ++i) {
		int x;
		cin >> x;

		values.push_back(x);
		aset[x] = 0;
	}

	for (int i = 0; i < n; ++i) {
		int value = values[i];

		if (checkSet(value, 1)) {
			doSet(value, 1);
		}
		else if (checkSet(value, 2)) {
			doSet(value, 2);
		}
		else {
			cout << "NO" << endl;
			return 0;
		}
	}

	cout << "YES" << endl;

	for (int i = 0; i < n; ++i) {
		cout << aset[values[i]] - 1 << ' ';
	}

	cout << endl;
}


#include <iostream>
#include <map>
#include <vector>
#include <algorithm>

using namespace std;

int A, B;
map<int, int> aset;
map<int, int> marks;

bool checkSet(int x, int s) {
	int svalue = s == 1 ? A : B;
	int y = svalue - x;

	auto it = aset.find(x);

	if (it == aset.end()) {
		return false;
	}

	if (it->second == s) {
		return true;
	}

	if (marks[x]) {
		return marks[x] == s;
	}

	if (it->second == 0) {
		marks[x] = s;
		bool result = checkSet(y, s);

		marks[x] = 0;
		return result;
	}

	if (marks[x] != 0) {
		return false;
	}

	int olds = it->second;
	int tvalue = olds == 1 ? A : B;
	int z = tvalue - x;

	marks[x] = s;
	bool result = checkSet(z, s) && checkSet(y, s);

	marks[x] = 0;
	return result;
}

void doSet(int x, int s) {
	int svalue = s == 1 ? A : B;
	int y = svalue - x;

	if (aset[x] == 0) {
		aset[x] = s;
		doSet(y, s);
	}
	else if (aset[x] != s) {
		int tvalue = aset[x] == 1 ? A : B;
		int z = tvalue - x;

		aset[x] = s;
		doSet(z, s);
		doSet(y, s);
	}
}

int main() {
	int n;
	cin >> n >> A >> B;

	vector<int> values;

	for (int i = 0; i < n; ++i) {
		int x;
		cin >> x;

		values.push_back(x);
		aset[x] = 0;
	}

	for (int i = 0; i < n; ++i) {
		int value = values[i];

		if (aset[value] != 0) {
			continue;
		}

		if (checkSet(value, 1)) {
			doSet(value, 1);
		}
		else if (checkSet(value, 2)) {
			doSet(value, 2);
		}
		else {
			cout << "NO" << endl;
			return 0;
		}
	}

	cout << "YES" << endl;

	for (int i = 0; i < n; ++i) {
		cout << aset[values[i]] - 1 << ' ';
	}

	cout << endl;
}


#include <iostream>
#include <map>
#include <vector>
#include <algorithm>

using namespace std;

int A, B;
map<int, int> aset;
map<int, int> marks;

bool trySet(int x, int s) {
	int svalue = s == 1 ? A : B;
	int y = svalue - x;

	auto it = aset.find(x);

	if (it == aset.end()) {
		return false;
	}

	if (it->second == s) {
		return true;
	}

	if (it->second == 0) {
		it->second = s;
		marks[x] = s;

		if (trySet(y, s)) {
			marks[x] = 0;
			return true;
		}

		it->second = 0;
		marks[x] = 0;
		return false;
	}

	if (marks[x] != 0) {
		return false;
	}

	int olds = it->second;
	int tvalue = olds == 1 ? A : B;
	int z = tvalue - x;

	it->second = s;
	marks[x] = s;

	if (trySet(z, s) && trySet(y, s))  {
		marks[x] = 0;
		return true;
	}

	it->second = olds;
	marks[x] = 0;
	return false;
}

int main() {
	int n;
	cin >> n >> A >> B;

	vector<int> values;

	for (int i = 0; i < n; ++i) {
		int x;
		cin >> x;

		values.push_back(x);
		aset[x] = 0;
	}

	for (int i = 0; i < n; ++i) {
		int value = values[i];

		if (!trySet(value, 1) && !trySet(value, 2)) {
			cout << "NO" << endl;
			return 0;
		}

		int s = aset[values[i]];
		if (aset[(s == 1 ? A : B) - values[i]] != s) {
			cout << "NO " << i << " " << values[i] << endl;
			return 0;
		}
	}

	cout << "YES" << endl;

	for (int i = 0; i < n; ++i) {
		cout << aset[values[i]] - 1 << ' ';
	}

	cout << endl;
}


#include <iostream>
#include <set>
#include <vector>
#include <algorithm>

using namespace std;

char C[100000];

int main() {
	int n, a, b;
	cin >> n >> a >> b;

	set<int> iset;
	vector<pair<int, int>> values;

	for (int i = 0; i < n; ++i) {
		int x;
		cin >> x;

		values.push_back(make_pair(x, i));
		iset.insert(x);
	}

	sort(values.begin(), values.end());

	for (int i = 0; i < n; ++i) {
		auto& p = values[i];
		int value = p.first;
		int index = p.second;

		if (iset.find(a - value) != iset.end()) {
			C[index] = 1;
		}
		else if (iset.find(b - value) != iset.end()) {
			C[index] = 2;
		}
		else {
			cout << "NO" << endl;
			return 0;
		}
	}

	cout << "YES" << endl;

	for (int i = 0; i < n; ++i) {
		cout << C[i] - 1 << ' ';
	}

	cout << endl;
}


#include <iostream>
#include <map>
#include <vector>
#include <algorithm>

using namespace std;

int A, B;
map<int, int> aset;
map<int, int> marks;

bool trySet(int x, int s) {
	int svalue = s == 1 ? A : B;
	int y = svalue - x;

	auto it = aset.find(x);

	if (it == aset.end()) {
		return false;
	}

	if (it->second == s) {
		return true;
	}

	if (it->second == 0) {
		it->second = s;
		marks[x] = s;

		if (trySet(y, s)) {
			marks[x] = 0;
			return true;
		}

		it->second = 0;
		marks[x] = 0;
		return false;
	}

	if (marks[x] != 0) {
		return false;
	}

	int olds = it->second;
	int tvalue = olds == 1 ? A : B;
	int z = tvalue - x;

	it->second = s;
	marks[x] = s;

	if (trySet(z, s) && trySet(y, s))  {
		marks[x] = 0;
		return true;
	}

	it->second = olds;
	marks[x] = 0;
	return false;
}

int main() {
	int n;
	cin >> n >> A >> B;

	vector<int> values;

	for (int i = 0; i < n; ++i) {
		int x;
		cin >> x;

		values.push_back(x);
		aset[x] = 0;
	}

	for (int i = 0; i < n; ++i) {
		int value = values[i];

		if (!trySet(value, 1) && !trySet(value, 2)) {
			cout << "NO" << endl;
			return 0;
		}
	}

	cout << "YES" << endl;

	for (int i = 0; i < n; ++i) {
		int s = aset[values[i]];
		if (aset[(s == 1 ? A : B) - values[i]] == 0) {
			cout << '!' << endl;
		}
		cout << aset[values[i]] - 1 << ' ';
	}

	cout << endl;
}


#include <iostream>
#include <map>
#include <vector>
#include <algorithm>

using namespace std;

int A, B;
map<int, int> aset;

bool trySet(int x, int s) {
	int svalue = s == 1 ? A : B;
	int y = svalue - x;

	auto it = aset.find(x);

	if (it == aset.end()) {
		return false;
	}

	if (it->second == s) {
		return true;
	}

	if (it->second == 0) {
		it->second = s;
		if (trySet(y, s)) {
			return true;
		}

		it->second = 0;
		return false;
	}

	int oldvalue = it->second;
	it->second = s;
	int tvalue = B + A - svalue;
	int z = tvalue - x;

	if (trySet(z, s) && trySet(y, s))  {
		return true;
	}

	it->second = oldvalue;
	return false;
}

int main() {
	int n;
	cin >> n >> A >> B;

	vector<int> values;

	for (int i = 0; i < n; ++i) {
		int x;
		cin >> x;

		values.push_back(x);
		aset[x] = 0;
	}

	for (int i = 0; i < n; ++i) {
		int value = values[i];

		if (!trySet(value, 1) && !trySet(value, 2)) {
			cout << "NO" << endl;
			return 0;
		}
	}

	cout << "YES" << endl;

	for (int i = 0; i < n; ++i) {
		cout << aset[values[i]] - 1 << ' ';
	}

	cout << endl;
}


#include <iostream>
#include <map>
#include <vector>
#include <algorithm>

using namespace std;

int A, B;
map<int, int> aset;
map<int, int> marks;

bool trySet(int x, int s) {
	int svalue = s == 1 ? A : B;
	int y = svalue - x;

	auto it = aset.find(x);

	if (it == aset.end()) {
		return false;
	}

	if (it->second == s) {
		return true;
	}

	if (it->second == 0) {
		it->second = s;
		marks[x] = s;

		if (trySet(y, s)) {
			marks[x] = 0;
			return true;
		}

		it->second = 0;
		marks[x] = 0;
		return false;
	}

	if (marks[x] != 0) {
		return false;
	}

	int tvalue = B + A - svalue;
	int z = tvalue - x;
	int oldvalue = it->second;

	it->second = s;
	marks[x] = s;

	if (trySet(z, s) && trySet(y, s))  {
		marks[x] = 0;
		return true;
	}

	it->second = oldvalue;
	marks[x] = 0;
	return false;
}

int main() {
	int n;
	cin >> n >> A >> B;

	vector<int> values;

	for (int i = 0; i < n; ++i) {
		int x;
		cin >> x;

		values.push_back(x);
		aset[x] = 0;
	}

	for (int i = 0; i < n; ++i) {
		int value = values[i];

		if (!trySet(value, 1) && !trySet(value, 2)) {
			cout << "NO" << endl;
			return 0;
		}
	}

	cout << "YES" << endl;

	for (int i = 0; i < n; ++i) {
		cout << aset[values[i]] - 1 << ' ';
	}

	cout << endl;
}


#include <iostream>
#include <set>
#include <vector>
#include <algorithm>

using namespace std;

char C[100000];

int main() {
	int n, a, b;
	cin >> n >> a >> b;

	set<int> iset;
	set<int> aset;
	set<int> bset;
	vector<int> values;

	for (int i = 0; i < n; ++i) {
		int x;
		cin >> x;

		values.push_back(x);
		iset.insert(x);
	}

	for (int i = 0; i < n; ++i) {
		int value = values[i];

		if (iset.find(a - value) != iset.end() && bset.find(a - value) == bset.end()) {
			C[i] = 1;
			aset.insert(a - value);
		}
		else if (iset.find(b - value) != iset.end() && aset.find(b - value) == aset.end()) {
			C[i] = 2;
			bset.insert(b - value);
		}
		else {
			cout << "NO" << endl;
			return 0;
		}
	}

	cout << "YES" << endl;

	for (int i = 0; i < n; ++i) {
		cout << C[i] - 1 << ' ';
	}

	cout << endl;
}


//Michał Glapa
#include<cstdio>
#include<set>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<cstdlib>
#include<time.h>
#include<string>
#include<stack>
#include<cmath>
#include<iostream>
#include<cstring>
#include<complex>
#include<unordered_set>
#include<unordered_map>
#include<numeric>
using namespace std;
#define FOR(i,j,k) for(int i=j;i<=k;i++)
#define REP(i,n) for(int i=0;i<n;i++)
#define FORD(i,j,k) for(int i=j;i>=k;i--)
#define ll long long
//Make sure no overflow problems
#define int long long
#define pb push_back
#define mp make_pair
#define x first
#define y second
#define all(x) x.begin(),x.end()
#define ld long double
#define mini(x,y) x=min(x,y)
#define maxi(x,y) x=max(x,y)
#define CLR(a,x) memset(a,x,sizeof(a))
#define SIZE(x) ((int)x.size())
const int INF = 1000000009;
const long long INFLL = (ll)INF * (ll)INF;
const ld EPS = 10e-9;
typedef vector<int> vi;
typedef pair<int,int> pii;

//reading and printing
void read(int &n) {scanf("%lld",&n);}
void read(double &d) {scanf("%lf",&d);}
void read(string &s) {cin >>s;}
void read(char * c) {scanf("%s",c);}
template<typename T>
void read(vector<T> & v, int n) {int tmp; REP(i,n){read(tmp); v.pb(tmp);};}
template<typename T, typename V>
void read(pair<T,V> & p) {read(p.x); read(p.y);}
void print(int &n) {printf("%lld\n",n);}
void print(double &d) {printf("%.9lf\n",d);}
void print(string &s) {cout << s << endl;}
void print(char *c) {printf("%s\n",c);}
void print_(int &n) {printf("%lld ",n);}
void print_(double & d) {printf("%lf ",d);}
void print_(string &s) {cout << s <<" ";}
void print_(char * c){printf("%s ",c);}
template<typename T>
void print(vector<T> &v) {for(auto &i : v) print_(i); printf("\n");}
template<typename T,typename V>
void print(pair<T,V> &p) {print_(p.x);print(p.y);}
template<typename T,typename V>
void print_(pair<T,V> &p) {print_(p.x);print_(p.y);}

//useful funcs
template<typename T>
void unique(vector<T> & v) {v.resize(unique(v.begin(),v.end())-v.begin());}
vi range (int a, int b) {vi res; FOR(i,a,b-1) res.pb(i); return res;}
vector<pii> zip(vi &a, vi & b) {vector<pii> res; REP(i,SIZE(a)) res.pb(mp(a[i],b[i])); return res;}
vector<pii> zip(vi a, vi  b) {vector<pii> res; REP(i,SIZE(b)) res.pb(mp(a[i],b[i])); return res;}

///////////////////////////////////////////////////////////////
#include<vector>
#include<cstdlib>
#include<algorithm>
using namespace std;
/* Class containing the graph, and doing stuff */
class Two_SAT
{
    public:
        int neg(int x) // negation of a variable
        {
            if(x>=n)
                return x-n;
            return x+n;
        }
        void add_alt(int a, int b) // adds an alternative. For example C.add_alt(1,2) or C.add_alt(C.neg(1),2);
        {
            graph[neg(a)].push_back(b);
            graph[neg(b)].push_back(a);
        }
        void add_edge(int a, int b) // adds implication a=>b
        {
            graph[a].push_back(b);
        }
        Two_SAT(int n):n(n) // n is the number of variables, last variable is variable n-1
        {
            srand(1337);
            graph = vector<vector<int> > (2*n);
            vis = vector<bool> (2*n);
            fail=false;
        }
        bool solve() //returns true if there exists a labeling and false otherwise
        {
            vis = vector<bool> (2*n);
            vector<int> order = vector<int> (2*n);
            for(int i=0;i<2*n;i++)
                order[i]=i;
            random_shuffle(order.begin(),order.end());
            for(vector<int>::iterator i = order.begin();i!=order.end();i++)
            {
                if(vis[*i]||vis[neg(*i)])
                    continue;
                changes.clear();
                dfs(*i);
                if(fail)
                {
                    for(int j=0;j<(int)changes.size();j++)
                        vis[changes[j]]=false;
                    fail=false;
                    changes.clear();
                    dfs(neg(*i));
                    if(fail)
                        break;
                }

            }
            return !fail;
        }
        bool get_variable(int x) // true if x is true, false otherwise
        {
            return vis[x];
        }
    private:
        int n;
        bool fail;
        vector<vector<int> > graph;
        vector<bool> vis;
        vector<int> changes;
        void dfs(int v)
        {
            changes.push_back(v);
            vis[v]=true;
            if(vis[neg(v)])
                fail=true;
            for(vector<int>::iterator i=graph[v].begin();i!=graph[v].end();i++)
                if(!vis[*i])
                    dfs(*i);

        }
};
main()
{
    int n, a,b;
    read(n); read(a); read(b);
    vi v;
    read(v,n);
    unordered_map<int,int> m;
    REP(i,n)
        m[v[i]]=i;
    Two_SAT T = Two_SAT(n);
    REP(i,n)
    {
        int val = v[i];
        if(m.find(a-val)!=m.end())
        {
            T.add_edge(i,m[a-val]);
        }
        else
        {
            T.add_alt(T.neg(i),T.neg(i));
        }
        if(m.find(b-val)!=m.end())
        {
            T.add_edge(T.neg(i), T.neg(m[b-val]));
        }
        else
        {
            T.add_alt(i,i);
        }
    }
    if(T.solve())
    {
        printf("YES\n");
        REP(i,n)
            printf("%s ",T.get_variable(i) ? "0" : "1");
        printf("\n");
    }
    else
    {
        printf("NO\n");
    }

}


//Michał Glapa
#include<cstdio>
#include<set>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<cstdlib>
#include<time.h>
#include<string>
#include<stack>
#include<cmath>
#include<iostream>
#include<cstring>
#include<complex>
#include<unordered_set>
#include<unordered_map>
#include<numeric>
using namespace std;
#define FOR(i,j,k) for(int i=j;i<=k;i++)
#define REP(i,n) for(int i=0;i<n;i++)
#define FORD(i,j,k) for(int i=j;i>=k;i--)
#define ll long long
//Make sure no overflow problems
#define int long long
#define pb push_back
#define mp make_pair
#define x first
#define y second
#define all(x) x.begin(),x.end()
#define ld long double
#define mini(x,y) x=min(x,y)
#define maxi(x,y) x=max(x,y)
#define CLR(a,x) memset(a,x,sizeof(a))
#define SIZE(x) ((int)x.size())
const int INF = 1000000009;
const long long INFLL = (ll)INF * (ll)INF;
const ld EPS = 10e-9;
typedef vector<int> vi;
typedef pair<int,int> pii;

//reading and printing
void read(int &n) {scanf("%lld",&n);}
void read(double &d) {scanf("%lf",&d);}
void read(string &s) {cin >>s;}
void read(char * c) {scanf("%s",c);}
template<typename T>
void read(vector<T> & v, int n) {int tmp; REP(i,n){read(tmp); v.pb(tmp);};}
template<typename T, typename V>
void read(pair<T,V> & p) {read(p.x); read(p.y);}
void print(int &n) {printf("%lld\n",n);}
void print(double &d) {printf("%.9lf\n",d);}
void print(string &s) {cout << s << endl;}
void print(char *c) {printf("%s\n",c);}
void print_(int &n) {printf("%lld ",n);}
void print_(double & d) {printf("%lf ",d);}
void print_(string &s) {cout << s <<" ";}
void print_(char * c){printf("%s ",c);}
template<typename T>
void print(vector<T> &v) {for(auto &i : v) print_(i); printf("\n");}
template<typename T,typename V>
void print(pair<T,V> &p) {print_(p.x);print(p.y);}
template<typename T,typename V>
void print_(pair<T,V> &p) {print_(p.x);print_(p.y);}

//useful funcs
template<typename T>
void unique(vector<T> & v) {v.resize(unique(v.begin(),v.end())-v.begin());}
vi range (int a, int b) {vi res; FOR(i,a,b-1) res.pb(i); return res;}
vector<pii> zip(vi &a, vi & b) {vector<pii> res; REP(i,SIZE(a)) res.pb(mp(a[i],b[i])); return res;}
vector<pii> zip(vi a, vi  b) {vector<pii> res; REP(i,SIZE(b)) res.pb(mp(a[i],b[i])); return res;}

///////////////////////////////////////////////////////////////
#include<vector>
#include<cstdlib>
#include<algorithm>
using namespace std;
/* Class containing the graph, and doing stuff */
class Two_SAT
{
    public:
        int neg(int x) // negation of a variable
        {
            if(x>=n)
                return x-n;
            return x+n;
        }
        void add_alt(int a, int b) // adds an alternative. For example C.add_alt(1,2) or C.add_alt(C.neg(1),2);
        {
            graph[neg(a)].push_back(b);
            graph[neg(b)].push_back(a);
        }
        void add_edge(int a, int b) // adds implication a=>b
        {
            graph[a].push_back(b);
        }
        Two_SAT(int n):n(n) // n is the number of variables, last variable is variable n-1
        {
            srand(1337);
            graph = vector<vector<int> > (2*n);
            vis = vector<bool> (2*n);
            fail=false;
        }
        bool solve() //returns true if there exists a labeling and false otherwise
        {
            vis = vector<bool> (2*n);
            vector<int> order = vector<int> (2*n);
            for(int i=0;i<2*n;i++)
                order[i]=i;
            random_shuffle(order.begin(),order.end());
            for(vector<int>::iterator i = order.begin();i!=order.end();i++)
            {
                if(vis[*i]||vis[neg(*i)])
                    continue;
                changes.clear();
                dfs(*i);
                if(fail)
                {
                    for(int j=0;j<(int)changes.size();j++)
                        vis[changes[j]]=false;
                    fail=false;
                    changes.clear();
                    dfs(neg(*i));
                    if(fail)
                        break;
                }

            }
            return !fail;
        }
        bool get_variable(int x) // true if x is true, false otherwise
        {
            return vis[x];
        }
    private:
        int n;
        bool fail;
        vector<vector<int> > graph;
        vector<bool> vis;
        vector<int> changes;
        void dfs(int v)
        {
            changes.push_back(v);
            vis[v]=true;
            if(vis[neg(v)])
                fail=true;
            for(vector<int>::iterator i=graph[v].begin();i!=graph[v].end();i++)
                if(!vis[*i])
                    dfs(*i);

        }
};
main()
{
    int n, a,b;
    read(n); read(a); read(b);
    vi v;
    read(v,n);
    unordered_map<int,int> m;
    REP(i,n)
        m[v[i]]=i;
    Two_SAT T = Two_SAT(n);
    REP(i,n)
    {
        int val = v[i];
        if(m.find(a-val)!=m.end())
        {
            T.add_edge(i,m[a-val]);
        }
        else
        {
            T.add_edge(i,T.neg(i));
        }
        if(m.find(b-val)!=m.end())
        {
            T.add_edge(T.neg(i), T.neg(m[b-val]));
        }
        else
        {
            T.add_edge(T.neg(i),i);
        }
    }
    if(T.solve())
    {
        printf("YES\n");
        REP(i,n)
            printf("%s ",T.get_variable(i) ? "0" : "1");
    }
    else
    {
        printf("NO\n");
    }

}


//Michał Glapa
#include<cstdio>
#include<set>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<cstdlib>
#include<time.h>
#include<string>
#include<stack>
#include<cmath>
#include<iostream>
#include<cstring>
#include<complex>
#include<unordered_set>
#include<unordered_map>
#include<numeric>
using namespace std;
#define FOR(i,j,k) for(int i=j;i<=k;i++)
#define REP(i,n) for(int i=0;i<n;i++)
#define FORD(i,j,k) for(int i=j;i>=k;i--)
#define FOREACH(i,c) for(__typeof((c).begin()) i = (c).begin();i!=(c).end();i++)
#define ll long long
//Make sure no overflow problems
#define int long long
#define pb push_back
#define mp make_pair
#define x first
#define y second
#define all(x) x.begin(),x.end()
#define ld long double
#define mini(x,y) x=min(x,y)
#define maxi(x,y) x=max(x,y)
#define CLR(a,x) memset(a,x,sizeof(a))
#define SIZE(x) ((int)x.size())
const int INF = 1000000009;
const long long INFLL = (ll)INF * (ll)INF;
const ld EPS = 10e-9;
typedef vector<int> vi;
typedef pair<int,int> pii;

//reading and printing
void read(int &n) {scanf("%lld",&n);}
void read(double &d) {scanf("%lf",&d);}
void read(string &s) {cin >>s;}
void read(char * c) {scanf("%s",c);}
template<typename T>
void read(vector<T> & v, int n) {int tmp; REP(i,n){read(tmp); v.pb(tmp);};}
template<typename T, typename V>
void read(pair<T,V> & p) {read(p.x); read(p.y);}
void print(int &n) {printf("%lld\n",n);}
void print(double &d) {printf("%.9lf\n",d);}
void print(string &s) {cout << s << endl;}
void print(char *c) {printf("%s\n",c);}
void print_(int &n) {printf("%lld ",n);}
void print_(double & d) {printf("%lf ",d);}
void print_(string &s) {cout << s <<" ";}
void print_(char * c){printf("%s ",c);}
template<typename T>
void print(vector<T> &v) {for(auto &i : v) print_(i); printf("\n");}
template<typename T,typename V>
void print(pair<T,V> &p) {print_(p.x);print(p.y);}
template<typename T,typename V>
void print_(pair<T,V> &p) {print_(p.x);print_(p.y);}

//useful funcs
template<typename T>
void unique(vector<T> & v) {v.resize(unique(v.begin(),v.end())-v.begin());}
vi range (int a, int b) {vi res; FOR(i,a,b-1) res.pb(i); return res;}
vector<pii> zip(vi &a, vi & b) {vector<pii> res; REP(i,SIZE(a)) res.pb(mp(a[i],b[i])); return res;}
vector<pii> zip(vi a, vi  b) {vector<pii> res; REP(i,SIZE(b)) res.pb(mp(a[i],b[i])); return res;}

// SILNIE SPÓJNE SKŁADOWE (algrotym Tarjana) + 2SAT
// Adam Polak
namespace sat {
const int N = 300*1000;
const int NIL = (-1);

int n;              // INPUT
vector<int> g[N];   // INPUT

int t, in[N], low[N];
stack<int> s;
bool stacked[N];

int scc[N], scc_n;  // OUTPUT (SCC)
bool value[N];      // OUTPUT (2SAT)

void tarjan(int u) {
    low[u] = in[u] = t++;
    s.push(u);
    stacked[u] = true;
    FOREACH(v, g[u]) {
        if (in[*v]==NIL) {
            tarjan(*v);
            low[u] = min(low[u], low[*v]);
        } else if (stacked[*v]) low[u] = min(low[u], in[*v]);
    }
    if (low[u]==in[u]) {
        for(;;) {
            int v = s.top(); s.pop();
            stacked[v] = false;
            scc[v] = scc_n;
            if (v==u) break;
        }
        scc_n++;
    }
}

void tarjan_scc() {
	REP(i,n) { in[i] = low[i] = NIL; stacked[i] = false; }
	scc_n = t = 0;
	REP(i,n) if(in[i]==NIL) tarjan(i);
}

// 2SAT usage:
// 1) n = 2*variables
// 2) REP(i,n) g[i].clear();
// 3) add_constr(...) //np. add_constr(zm1, 1, zm2, 0) = ((NOT zm1) OR zm2)
// 4) solve_2sat();
void add_constr(int a, bool neg_a, int b, bool neg_b) {
    g[2*a+neg_a].push_back(2*b+1-neg_b);
    g[2*b+neg_b].push_back(2*a+1-neg_a);
}

bool solve_2sat() {
    tarjan_scc();
    int v[scc_n], c[scc_n];
    REP(i,(n/2)) if (scc[2*i]==scc[2*i+1]) return false;
    REP(i,n) v[scc[i]] = i;
    REP(i,scc_n) c[i] = NIL;
    REP(i,scc_n) if (c[i]==NIL) {
        c[i] = 1;
        c[scc[v[i]^1]] = 0;
    }
    REP(i,(n/2)) value[i] = c[scc[2*i+1]];
    return true;
}
}
main()
{
    int n, a,b;
    read(n); read(a); read(b);
    vi v;
    read(v,n);
    unordered_map<int,int> m;
    REP(i,n)
        m[v[i]]=i;
    sat::n = 2*n;
    REP(i,n)
    {
        int val = v[i];
        if(m.find(a-val)!=m.end())
        {
            sat::add_constr(i,1,m[a-val],0);
        }
        else
        {
            sat::add_constr(i,1,i,1);
        }
        if(m.find(b-val)!=m.end())
        {
            sat::add_constr(i,0,m[b-val],1);
        }
        else
        {
            sat::add_constr(i,0,i,0);
        }
    }
    if(sat::solve_2sat())
    {
        printf("YES\n");
        REP(i,n)
            printf("%s ",sat::value[i] ? "0" : "1");
        printf("\n");
    }
    else
    {
        printf("NO\n");
    }

}


//Michał Glapa
#include<cstdio>
#include<set>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<cstdlib>
#include<time.h>
#include<string>
#include<stack>
#include<cmath>
#include<iostream>
#include<cstring>
#include<complex>
#include<unordered_set>
#include<unordered_map>
#include<numeric>
using namespace std;
#define FOR(i,j,k) for(int i=j;i<=k;i++)
#define REP(i,n) for(int i=0;i<n;i++)
#define FORD(i,j,k) for(int i=j;i>=k;i--)
#define ll long long
//Make sure no overflow problems
#define int long long
#define pb push_back
#define mp make_pair
#define x first
#define y second
#define all(x) x.begin(),x.end()
#define ld long double
#define mini(x,y) x=min(x,y)
#define maxi(x,y) x=max(x,y)
#define CLR(a,x) memset(a,x,sizeof(a))
#define SIZE(x) ((int)x.size())
const int INF = 1000000009;
const long long INFLL = (ll)INF * (ll)INF;
const ld EPS = 10e-9;
typedef vector<int> vi;
typedef pair<int,int> pii;

//reading and printing
void read(int &n) {scanf("%lld",&n);}
void read(double &d) {scanf("%lf",&d);}
void read(string &s) {cin >>s;}
void read(char * c) {scanf("%s",c);}
template<typename T>
void read(vector<T> & v, int n) {int tmp; REP(i,n){read(tmp); v.pb(tmp);};}
template<typename T, typename V>
void read(pair<T,V> & p) {read(p.x); read(p.y);}
void print(int &n) {printf("%lld\n",n);}
void print(double &d) {printf("%.9lf\n",d);}
void print(string &s) {cout << s << endl;}
void print(char *c) {printf("%s\n",c);}
void print_(int &n) {printf("%lld ",n);}
void print_(double & d) {printf("%lf ",d);}
void print_(string &s) {cout << s <<" ";}
void print_(char * c){printf("%s ",c);}
template<typename T>
void print(vector<T> &v) {for(auto &i : v) print_(i); printf("\n");}
template<typename T,typename V>
void print(pair<T,V> &p) {print_(p.x);print(p.y);}
template<typename T,typename V>
void print_(pair<T,V> &p) {print_(p.x);print_(p.y);}

//useful funcs
template<typename T>
void unique(vector<T> & v) {v.resize(unique(v.begin(),v.end())-v.begin());}
vi range (int a, int b) {vi res; FOR(i,a,b-1) res.pb(i); return res;}
vector<pii> zip(vi &a, vi & b) {vector<pii> res; REP(i,SIZE(a)) res.pb(mp(a[i],b[i])); return res;}
vector<pii> zip(vi a, vi  b) {vector<pii> res; REP(i,SIZE(b)) res.pb(mp(a[i],b[i])); return res;}

///////////////////////////////////////////////////////////////
#include<vector>
#include<cstdlib>
#include<algorithm>
using namespace std;
/* Class containing the graph, and doing stuff */
class Two_SAT
{
    public:
        int neg(int x) // negation of a variable
        {
            if(x>=n)
                return x-n;
            return x+n;
        }
        void add_alt(int a, int b) // adds an alternative. For example C.add_alt(1,2) or C.add_alt(C.neg(1),2);
        {
            graph[neg(a)].push_back(b);
            graph[neg(b)].push_back(a);
        }
        void add_edge(int a, int b) // adds implication a=>b
        {
            graph[a].push_back(b);
        }
        Two_SAT(int n):n(n) // n is the number of variables, last variable is variable n-1
        {
            srand(1337);
            graph = vector<vector<int> > (2*n);
            vis = vector<bool> (2*n);
            fail=false;
        }
        bool solve() //returns true if there exists a labeling and false otherwise
        {
            vis = vector<bool> (2*n);
            vector<int> order = vector<int> (2*n);
            for(int i=0;i<2*n;i++)
                order[i]=i;
            random_shuffle(order.begin(),order.end());
            for(vector<int>::iterator i = order.begin();i!=order.end();i++)
            {
                if(vis[*i]||vis[neg(*i)])
                    continue;
                changes.clear();
                dfs(*i);
                if(fail)
                {
                    for(int j=0;j<(int)changes.size();j++)
                        vis[changes[j]]=false;
                    fail=false;
                    changes.clear();
                    dfs(neg(*i));
                    if(fail)
                        break;
                }

            }
            return !fail;
        }
        bool get_variable(int x) // true if x is true, false otherwise
        {
            return vis[x];
        }
    private:
        int n;
        bool fail;
        vector<vector<int> > graph;
        vector<bool> vis;
        vector<int> changes;
        void dfs(int v)
        {
            changes.push_back(v);
            vis[v]=true;
            if(vis[neg(v)])
                fail=true;
            for(vector<int>::iterator i=graph[v].begin();i!=graph[v].end();i++)
                if(!vis[*i])
                    dfs(*i);

        }
};
main()
{
    int n, a,b;
    read(n); read(a); read(b);
    vi v;
    read(v,n);
    unordered_map<int,int> m;
    REP(i,n)
        m[v[i]]=i;
    Two_SAT T = Two_SAT(n);
    REP(i,n)
    {
        int val = v[i];
        if(m.find(a-val)!=m.end())
        {
            T.add_edge(i,m[a-val]);
            T.add_edge(m[a-val],i);
        }
        else
        {
            T.add_alt(T.neg(i),T.neg(i));
        }
        if(m.find(b-val)!=m.end())
        {
            T.add_edge(T.neg(i), T.neg(m[b-val]));
            T.add_edge( T.neg(m[b-val]), T.neg(i));
        }
        else
        {
            T.add_alt(i,i);
        }
    }
    if(T.solve())
    {
        printf("YES\n");
        REP(i,n)
            printf("%s ",T.get_variable(i) ? "0" : "1");
        printf("\n");
    }
    else
    {
        printf("NO\n");
    }

}


#include <iostream>
#include <map>
using namespace std;

long long N, A, B;
long long v[100005];
map<long long, int> ri;

int ans[100005];
int a_adj[100005];
int b_adj[100005];

void dfs(int i){
    if(ans[i]) return;
    if(ans[a_adj[i]] == 0 || ans[a_adj[i]] == 1){
        ans[a_adj[i]] = 1;
        ans[i] = 1;
        dfs(b_adj[a_adj[i]]);
        return;
    }
    ans[i] = 2;
    ans[b_adj[i]] = 2;
    dfs(a_adj[b_adj[i]]);
}

int main(){
    ios_base::sync_with_stdio(false);

    cin >> N >> A >> B;
    for(int i=0; i<N; i++){
        cin >> v[i];
        ri[v[i]] = i;
    }

    if(A == B){
        bool fine = true;
        for(int i=0; i<N; i++)
            fine &= ri.count(A - v[i]);
        if(fine){
            cout << "YES" << endl;
            for(int i=0; i<N; i++)
                cout << 0 << " ";
            cout << endl;
        }
        else cout << "NO" << endl;
        return 0;
    }

    for(int i=0; i<N; i++){
        a_adj[i] = b_adj[i] = -1;
        if(ri.count(A - v[i]))
            a_adj[i] = ri[A - v[i]];
        if(ri.count(B - v[i]))
            b_adj[i] = ri[B - v[i]];
    }

    for(int i=0; i<N; i++){
        if(ans[i]) continue;
        if(a_adj[i] == -1 && b_adj[i] == -1){
            cout << "NO" << endl;
            return 0;
        }
        if(a_adj[i] == -1){
            if(ans[b_adj[i]] == 1){
                cout << "NO" << endl;
                return 0;
            }
            ans[b_adj[i]] = 2;
            ans[i] = 2;
        }
        if(b_adj[i] == -1){
            if(ans[a_adj[i]] == 2){
                cout << "NO" << endl;
                return 0;
            }
            ans[a_adj[i]] = 1;
            ans[i] = 1;
        }
    }

    cout << "YES" << endl;
    for(int i=0; i<N; i++){
        dfs(i);
        cout << ans[i]-1 << " ";
    }
    cout << endl;
    return 0;

}


#include <iostream>
#include <map>
using namespace std;

long long N, A, B;
long long v[100005];
map<long long, int> ri;

int ans[100005];
int a_adj[100005];
int b_adj[100005];

bool dfs(int i){
    if(i == -1) return true;

    if(ans[i]) return true;
    if(a_adj[i]!=-1 && (ans[a_adj[i]] == 0)){
        ans[a_adj[i]] = 1;
        ans[i] = 1;
        return dfs(b_adj[a_adj[i]]);
    }
    else if(b_adj[i]!=-1 && (ans[b_adj[i]] == 0)){
        ans[i] = 2;
        ans[b_adj[i]] = 2;
        return dfs(a_adj[b_adj[i]]);
    }
    return false;
}

int main(){
    ios_base::sync_with_stdio(false);

    cin >> N >> A >> B;
    for(int i=0; i<N; i++){
        cin >> v[i];
        ri[v[i]] = i;
    }

    if(A == B){
        bool fine = true;
        for(int i=0; i<N; i++)
            fine &= ri.count(A - v[i]);
        if(fine){
            cout << "YES" << endl;
            for(int i=0; i<N; i++)
                cout << 0 << " ";
            cout << endl;
        }
        else cout << "NO" << endl;
        return 0;
    }

    bool good = true;

    for(int i=0; i<N; i++){
        a_adj[i] = b_adj[i] = -1;
        if(ri.count(A - v[i]))
            a_adj[i] = ri[A - v[i]];
        if(ri.count(B - v[i]))
            b_adj[i] = ri[B - v[i]];

        if(a_adj[i] == -1 && b_adj[i] == -1)
            good = false;
    }

    for(int i=0; i<N; i++)
        if(a_adj[i] == -1 || b_adj[i] == -1)
            good &= dfs(i);

    for(int i=0; i<N; i++)
        good &= dfs(i);

    if(!good){ cout << "NO" << endl; return 0; }

    cout << "YES" << endl;
    for(int i=0; i<N; i++)
        cout << ans[i]-1 << " ";
    cout << endl;
    return 0;

}


#include <iostream>
#include <map>
using namespace std;

long long N, A, B;
long long v[100005];
map<long long, int> ri;

int ans[100005];
int a_adj[100005];
int b_adj[100005];

void dfs(int i){
    if(ans[i]) return;
    if(ans[a_adj[i]] == 0 || ans[a_adj[i]] == 1){
        ans[a_adj[i]] = 1;
        ans[i] = 1;
        dfs(b_adj[a_adj[i]]);
    }
    ans[i] = 2;
    ans[b_adj[i]] = 2;
    dfs(a_adj[b_adj[i]]);
}

int main(){
    cin >> N >> A >> B;
    for(int i=0; i<N; i++){
        cin >> v[i];
        ri[v[i]] = i;
    }

    if(A == B){
        bool fine = true;
        for(int i=0; i<N; i++)
            fine &= ri.count(A - v[i]);
        if(fine){
            cout << "YES" << endl;
            for(int i=0; i<N; i++)
                cout << 0 << " ";
            cout << endl;
        }
        else cout << "NO" << endl;
        return 0;
    }

    for(int i=0; i<N; i++){
        a_adj[i] = b_adj[i] = -1;
        if(ri.count(A - v[i]))
            a_adj[i] = ri[A - v[i]];
        if(ri.count(B - v[i]))
            b_adj[i] = ri[B - v[i]];
    }

    for(int i=0; i<N; i++){
        if(ans[i]) continue;
        if(a_adj[i] == -1 && b_adj[i] == -1){
            cout << "NO" << endl;
            return 0;
        }
        if(a_adj[i] == -1){
            if(ans[b_adj[i]] == 1){
                cout << "NO" << endl;
                return 0;
            }
            ans[b_adj[i]] = 2;
            ans[i] = 2;
        }
        if(b_adj[i] == -1){
            if(ans[a_adj[i]] == 2){
                cout << "NO" << endl;
                return 0;
            }
            ans[a_adj[i]] = 1;
            ans[i] = 1;
        }
    }

    for(int i=0; i<N; i++){
        dfs(i);
        cout << ans[i]-1 << " ";
    }
    cout << endl;
    return 0;

}


#include <iostream>
#include <map>
using namespace std;

long long N, A, B;
long long v[100005];
map<long long, int> ri;

int ans[100005];
int a_adj[100005];
int b_adj[100005];

bool dfs(int i){
    if(ans[i]) return true;
    if(a_adj[i]!=-1 && (ans[a_adj[i]] == 0 || ans[a_adj[i]] == 1)){
        ans[a_adj[i]] = 1;
        ans[i] = 1;
        return dfs(b_adj[a_adj[i]]);
    }
    else if(b_adj[i]!=-1 && (ans[b_adj[i]] == 0 || ans[b_adj[i]] == 2)){
        ans[i] = 2;
        ans[b_adj[i]] = 2;
        return dfs(a_adj[b_adj[i]]);
    }
    return false;
}

int main(){
    ios_base::sync_with_stdio(false);

    cin >> N >> A >> B;
    for(int i=0; i<N; i++){
        cin >> v[i];
        ri[v[i]] = i;
    }

    if(A == B){
        bool fine = true;
        for(int i=0; i<N; i++)
            fine &= ri.count(A - v[i]);
        if(fine){
            cout << "YES" << endl;
            for(int i=0; i<N; i++)
                cout << 0 << " ";
            cout << endl;
        }
        else cout << "NO" << endl;
        return 0;
    }

    bool good = true;

    for(int i=0; i<N; i++){
        a_adj[i] = b_adj[i] = -1;
        if(ri.count(A - v[i]))
            a_adj[i] = ri[A - v[i]];
        if(ri.count(B - v[i]))
            b_adj[i] = ri[B - v[i]];

        if(a_adj[i] == -1 && b_adj[i] == -1)
            good = false;
    }

    for(int i=0; i<N; i++)
        if(a_adj[i] == -1 || b_adj[i] == -1)
            good &= dfs(i);

    for(int i=0; i<N; i++)
        good &= dfs(i);

    if(!good){ cout << "NO" << endl; return 0; }

    cout << "YES" << endl;
    for(int i=0; i<N; i++)
        cout << ans[i]-1 << " ";
    cout << endl;
    return 0;

}


#include <iostream>
#include <map>
using namespace std;

long long N, A, B;
long long v[100005];
map<long long, int> ri;

int ans[100005];
int a_adj[100005];
int b_adj[100005];

bool dfs(int i){
    if(i == -1) return true;

    if(ans[i]) return true;
    if(a_adj[i]!=-1 && (ans[a_adj[i]] == 0 || ans[a_adj[i]] == 1)){
        ans[a_adj[i]] = 1;
        ans[i] = 1;
        return dfs(b_adj[a_adj[i]]);
    }
    else if(b_adj[i]!=-1 && (ans[b_adj[i]] == 0 || ans[b_adj[i]] == 2)){
        ans[i] = 2;
        ans[b_adj[i]] = 2;
        return dfs(a_adj[b_adj[i]]);
    }
    return false;
}

int main(){
    ios_base::sync_with_stdio(false);

    cin >> N >> A >> B;
    for(int i=0; i<N; i++){
        cin >> v[i];
        ri[v[i]] = i;
    }

    if(A == B){
        bool fine = true;
        for(int i=0; i<N; i++)
            fine &= ri.count(A - v[i]);
        if(fine){
            cout << "YES" << endl;
            for(int i=0; i<N; i++)
                cout << 0 << " ";
            cout << endl;
        }
        else cout << "NO" << endl;
        return 0;
    }

    bool good = true;

    for(int i=0; i<N; i++){
        a_adj[i] = b_adj[i] = -1;
        if(ri.count(A - v[i]))
            a_adj[i] = ri[A - v[i]];
        if(ri.count(B - v[i]))
            b_adj[i] = ri[B - v[i]];

        if(a_adj[i] == -1 && b_adj[i] == -1)
            good = false;
    }

    for(int i=0; i<N; i++)
        if(a_adj[i] == -1 || b_adj[i] == -1)
            good &= dfs(i);

    for(int i=0; i<N; i++)
        good &= dfs(i);

    if(!good){ cout << "NO" << endl; return 0; }

    cout << "YES" << endl;
    for(int i=0; i<N; i++)
        cout << ans[i]-1 << " ";
    cout << endl;
    return 0;

}


#include <iostream>
#include <map>
using namespace std;

long long N, A, B;
long long v[100005];
map<long long, int> ri;

int ans[100005];
int a_adj[100005];
int b_adj[100005];

void dfs(int i){
    if(ans[i]) return;
    if(ans[a_adj[i]] == 0 || ans[a_adj[i]] == 1){
        ans[a_adj[i]] = 1;
        ans[i] = 1;
        dfs(b_adj[a_adj[i]]);
    }
    ans[i] = 2;
    ans[b_adj[i]] = 2;
    dfs(a_adj[b_adj[i]]);
}

int main(){
    ios_base::sync_with_stdio(false);

    cin >> N >> A >> B;
    for(int i=0; i<N; i++){
        cin >> v[i];
        ri[v[i]] = i;
    }

    if(A == B){
        bool fine = true;
        for(int i=0; i<N; i++)
            fine &= ri.count(A - v[i]);
        if(fine){
            cout << "YES" << endl;
            for(int i=0; i<N; i++)
                cout << 0 << " ";
            cout << endl;
        }
        else cout << "NO" << endl;
        return 0;
    }

    for(int i=0; i<N; i++){
        a_adj[i] = b_adj[i] = -1;
        if(ri.count(A - v[i]))
            a_adj[i] = ri[A - v[i]];
        if(ri.count(B - v[i]))
            b_adj[i] = ri[B - v[i]];
    }

    for(int i=0; i<N; i++){
        if(ans[i]) continue;
        if(a_adj[i] == -1 && b_adj[i] == -1){
            cout << "NO" << endl;
            return 0;
        }
        if(a_adj[i] == -1){
            if(ans[b_adj[i]] == 1){
                cout << "NO" << endl;
                return 0;
            }
            ans[b_adj[i]] = 2;
            ans[i] = 2;
        }
        if(b_adj[i] == -1){
            if(ans[a_adj[i]] == 2){
                cout << "NO" << endl;
                return 0;
            }
            ans[a_adj[i]] = 1;
            ans[i] = 1;
        }
    }

    cout << "YES" << endl;
    for(int i=0; i<N; i++){
        dfs(i);
        cout << ans[i]-1 << " ";
    }
    cout << endl;
    return 0;

}


#include <bits/stdc++.h>

using namespace std;
#define int long long
const int maxN = 1500 + 5;
const int mod = 1000*1000*1000 + 7;
vector<int> a[maxN];
map<int, int> mp;
int b[maxN];
int mark[maxN];

vector<int> ans;
int answer[maxN];

void dfs(int v)
{
    mark[v] = 1; ans.push_back(v);
    for(auto u : a[v])
	  if(!mark[u])
		dfs(u);
}

main()
{
    ios::sync_with_stdio(0); cin.tie(0);
    int n, ai, bi; cin >> n >> ai >> bi;
    for(int i = 0; i < n; i ++)
	  cin >> b[i], mp[b[i]] = i;

    for(int i = 0; i < n; i ++)
    {
	  int tmp = ai - b[i]; if(tmp == b[i]) { mark[i] = 1; continue; }
	  if(mp.count(tmp)) a[i].push_back(mp[tmp]);
	  tmp = bi - b[i]; if(tmp == b[i]) { mark[i] = 1; answer[i] = 1; continue; }
	  if(mp.count(tmp)) a[i].push_back(mp[tmp]);
	  if(!a[i].size()) { cout << "NO" << endl; return 0; }
    }
    vector<int> v;
    for(int i = 0; i < n; i ++)
	  if(a[i].size() == 1) v.push_back(i);
    for(int i = 0; i < v.size(); i ++)
	  if(!mark[v[i]])
	  {
		dfs(v[i]);
		if(ans.size() & 1) { cout << "NO" << endl; return 0; }

		for(int i = 0; i < ans.size(); i += 2)
		{
		    if(b[ans[i]] == bi - b[ans[i + 1]])
			  answer[ans[i]] = answer[ans[i + 1]] = 1;
		}
		ans.clear();
	  }

    for(int i = 0; i < n; i ++)
	  if(!mark[i])
	  {
		dfs(i);
		if(ans.size() & 1) { cout << "NO" << endl; return 0; }

		for(int i = 0; i < ans.size(); i += 2)
		{
		    if(b[ans[i]] == bi - b[ans[i + 1]])
			  answer[ans[i]] = answer[ans[i + 1]] = 1;
		}
		ans.clear();
	  }
    cout << "YES" << endl;
    for(int i = 0; i < n; i ++)
	  cout << answer[i] << ' ';
    cout << endl;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
#define int long long
const int maxN = 1500 + 5;
const int mod = 1000*1000*1000 + 7;
vector<int> a[maxN];
map<int, int> mp;
int b[maxN];
int mark[maxN];

vector<int> ans;
int answer[maxN];

void dfs(int v)
{
    mark[v] = 1; ans.push_back(v);
    for(auto u : a[v])
	  if(!mark[u])
		dfs(u);
}

main()
{
    ios::sync_with_stdio(0); cin.tie(0);
    int n, ai, bi; cin >> n >> ai >> bi;
    for(int i = 0; i < n; i ++)
	  cin >> b[i], mp[b[i]] = i;

    for(int i = 0; i < n; i ++)
    {
	  int tmp = ai - b[i];
	  if(mp.count(tmp)) a[i].push_back(mp[tmp]);
	  tmp = bi - b[i];
	  if(mp.count(tmp)) a[i].push_back(mp[tmp]);
	  if(!a[i].size()) { cout << "NO" << endl; return 0; }
    }

    vector<int> v;
    for(int i = 0; i < n; i ++)
	  if(a[i].size() == 1) v.push_back(i);
    for(int i = 0; i < v.size(); i ++)
	  if(!mark[v[i]])
	  {
		dfs(v[i]);
		if(ans.size() & 1) { cout << "NO" << endl; return 0; }

		for(int i = 0; i < ans.size(); i += 2)
		{
		    if(b[ans[i]] == bi - b[ans[i + 1]])
			  answer[ans[i]] = answer[ans[i + 1]] = 1;
		}
		ans.clear();
	  }

    for(int i = 0; i < n; i ++)
	  if(!mark[i])
	  {
		dfs(i);
		if(ans.size() & 1) { cout << "NO" << endl; return 0; }

		for(int i = 0; i < ans.size(); i += 2)
		{
		    if(b[ans[i]] == bi - b[ans[i + 1]])
			  answer[ans[i]] = answer[ans[i + 1]] = 1;
		}
		ans.clear();
	  }
    cout << "YES" << endl;
    for(int i = 0; i < n; i ++)
	  cout << answer[i] << ' ';
    cout << endl;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
//#define int long long
const int maxN = 1500 + 5;
const int mod = 1000*1000*1000 + 7;
vector<int> a[maxN];
map<int, int> mp;
int b[maxN];
int mark[maxN];

vector<int> ans;
int answer[maxN];

void dfs(int v)
{
    mark[v] = 1; ans.push_back(v);
    for(auto u : a[v])
	  if(!mark[u])
		dfs(u);
}

main()
{
    ios::sync_with_stdio(0); cin.tie(0);
    int n, ai, bi; cin >> n >> ai >> bi;
    for(int i = 0; i < n; i ++)
	  cin >> b[i], mp[b[i]] = i;

    for(int i = 0; i < n; i ++)
    {
	  int tmp = ai - b[i];
	  if(mp.count(tmp)) a[i].push_back(mp[tmp]);
	  tmp = bi - b[i];
	  if(mp.count(tmp)) a[i].push_back(mp[tmp]);
	  if(!a[i].size()) { cout << "NO" << endl; return 0; }
    }

    vector<int> v;
    for(int i = 0; i < n; i ++)
	  if(a[i].size() == 1) v.push_back(i);
    for(int i = 0; i < v.size(); i ++)
	  if(!mark[v[i]])
	  {
		dfs(v[i]);
		if(ans.size() & 1) { cout << "NO" << endl; return 0; }

		for(int i = 0; i < ans.size(); i += 2)
		{
		    if(b[ans[i]] == bi - b[ans[i + 1]])
			  answer[ans[i]] = answer[ans[i + 1]] = 1;
		}
		ans.clear();
	  }

    for(int i = 0; i < n; i ++)
	  if(!mark[i])
	  {
		dfs(i);
		if(ans.size() & 1) { cout << "NO" << endl; return 0; }

		for(int i = 0; i < ans.size(); i += 2)
		{
		    if(b[ans[i]] == bi - b[ans[i + 1]])
			  answer[ans[i]] = answer[ans[i + 1]] = 1;
		}
		ans.clear();
	  }
    cout << "YES" << endl;
    for(int i = 0; i < n; i ++)
	  cout << answer[i] << ' ';
    cout << endl;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
#define int long long
const int maxN = 100*1000 + 5;
const int mod = 1000*1000*1000 + 7;
vector<int> a[maxN];
map<int, int> mp;
int b[maxN];
int mark[maxN];

vector<int> ans;
int answer[maxN];

void dfs(int v)
{
    mark[v] = 1;
    for(auto u : a[v])
	  if(!mark[u])
		dfs(u);
    ans.push_back(v);
}

main()
{
    ios::sync_with_stdio(0); cin.tie(0);
    int n, ai, bi; cin >> n >> ai >> bi;
    for(int i = 0; i < n; i ++)
	  cin >> b[i], mp[b[i]] = i;

    for(int i = 0; i < n; i ++)
    {
	  int tmp = ai - b[i]; //if(tmp == b[i]) { mark[i] = 1; continue; }
	  if(mp.count(tmp)) a[i].push_back(mp[tmp]);
	  tmp = bi - b[i]; //if(tmp == b[i]) { mark[i] = 1; answer[i] = 1; continue; }
	  if(mp.count(tmp)) a[i].push_back(mp[tmp]);
	  if(!a[i].size()) { cout << "NO" << endl; return 0; }
    }
    vector<int> q;
    for(int i = 0; i < n; i ++)
	  if(2 * b[i] == ai || 2 * b[i] == bi) q.push_back(i);

       for(int i = 0; i < q.size(); i ++)
	  if(!mark[q[i]])
	  {
		dfs(q[i]);

		if(ans.size() & 1)
		{
		    if(bi == 2 * b[ans.back()]) answer[ans[0]] = 1;
		    ans.pop_back();
		}
		for(int i = 0; i < ans.size(); i += 2)
		{
		    if(b[ans[i]] == bi - b[ans[i + 1]])
			  answer[ans[i]] = answer[ans[i + 1]] = 1;
		}
		ans.clear();
	  }

    vector<int> v;
    for(int i = 0; i < n; i ++)
	  if(a[i].size() == 1) v.push_back(i);

    for(int i = 0; i < v.size(); i ++)
	  if(!mark[v[i]])
	  {
		dfs(v[i]);
		if(ans.size() & 1) { cout << "NO" << endl; return 0; }

		for(int i = 0; i < ans.size(); i += 2)
		{
		    if(b[ans[i]] == bi - b[ans[i + 1]])
			  answer[ans[i]] = answer[ans[i + 1]] = 1;
		}
		ans.clear();
	  }

    for(int i = 0; i < n; i ++)
	  if(!mark[i])
	  {
		dfs(i);

		if(ans.size() & 1) { cout << "NO" << endl; return 0; }

		for(int i = 0; i < ans.size(); i += 2)
		{
		    if(b[ans[i]] == bi - b[ans[i + 1]])
			  answer[ans[i]] = answer[ans[i + 1]] = 1;
		}
		ans.clear();
	  }
    cout << "YES" << endl;
    for(int i = 0; i < n; i ++)
	  cout << answer[i] << ' ';
    cout << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

const char lend = '\n';

const int N = 100000;
map<int, int> on, hav;
int vet[N], n, a, b, who[N];

bool cmp(int a, int b)
{
	return vet[a] > vet[b];
}

int main()
{
	ios::sync_with_stdio(0);

	cin >> n >> a >> b;
	for (int i = 0; i < n; ++i)
		cin >> vet[i], hav[vet[i]] = 1;
	memset(who, -1, sizeof who);

	bool g = 1;
	queue<int> que;
	for (int i = 0; i < n && g; ++i)
	{
		int x = vet[i];
		int y = a-x;
		int z = b-x;
		if (!hav[y] && !hav[z]) g = 0;
		else if (!hav[y] || a == b) que.push(x);
		else if (!hav[z]) que.push(x);
	}

	while (!que.empty())
	{
		int x = que.front();
		que.pop();
		if (!hav[x]) continue;
		int y = a-x;
		int z = b-x;
		if (!hav[y] && !hav[z]) g = 0;
		else if (!hav[y] || a == b)
		{
			if (on[x] == 1 || on[z] == 1) g = 0;
			else on[x] = 2, on[z] = 2, hav.erase(x), hav.erase(z), que.push(y), que.push(z), que.push(a-z), que.push(b-z), que.push(a-y), que.push(b-y);
		}
		else
		{
			if (on[x] == 2 || on[y] == 2) g = 0;
			else on[x] = 1, on[y] = 1, hav.erase(x), hav.erase(y), que.push(y), que.push(z), que.push(a-z), que.push(b-z), que.push(a-y), que.push(b-y);
		}
	}

	for (int i = 0; i < n && g; ++i)
		who[i] = on[vet[i]];

	if (!g) cout << "NO\n";
	else
	{
		cout << "YES\n";
		for (int i = 0; i < n; ++i)
			cout << (i?" ":"") << who[i]-1;
		cout << lend;
	}
}


#include <bits/stdc++.h>
using namespace std;

const char lend = '\n';

const int N = 100000;
map<int, vector<int> > cnt;
int vet[N], n, a, b, who[N];

void mark(int x, int v)
{
	who[cnt[x][0]] = v;
	cnt[x].erase(cnt[x].begin());
}

void push(int x, queue<int>& que)
{
	if (cnt[x].empty()) return;
	int y = a-x;
	int z = b-z;
	if (cnt[y].empty() || cnt[z].empty()) que.push(x);
}

int main()
{
	ios::sync_with_stdio(0);

	cin >> n >> a >> b;
	for (int i = 0; i < n; ++i)
		cin >> vet[i], cnt[vet[i]].push_back(i);

	memset(who, -1, sizeof who);
	bool g = 1;
	if (a == b)
	{
		for (int i = 0; i < n; ++i)
		{
			if (vet[i] >= a) g = 0;
			int y = vet[i];
			int x = a-vet[i];
			if (cnt[x].empty() || cnt[y].empty() || (x == y && cnt[x].size() < 2)) continue;
			else mark(x, 0), mark(y, 0);
		}
	}
	else
	{
		queue<int> que;
		for (int i = 0; i < n; ++i)
		{
			int x = vet[i];
			push(x, que);
		}
		while (!que.empty() && g)
		{
			int x = que.front();
			que.pop();
			int y = a-x, z = b-x;
			if (cnt[x].empty()) continue;
			else if (!cnt[y].empty()) mark(x, 0), mark(y, 0);
			else if (!cnt[z].empty()) mark(x, 1), mark(z, 1);
			else continue;
			push(x, que);
			push(y, que);
			push(z, que);
		}
	}

	for (int i = 0; i < n && g; ++i)
		g &= who[i] != -1;

	if (!g) cout << "NO\n";
	else
	{
		cout << "YES\n";
		for (int i = 0; i < n; ++i)
			cout << (i?" ":"") << who[i];
		cout << lend;
	}
}


#include <bits/stdc++.h>
using namespace std;

const char lend = '\n';

const int N = 100000;
map<int, vector<int> > cnt;
int vet[N], n, a, b, who[N];

void mark(int x, int v)
{
	who[cnt[x][0]] = v;
	cnt[x].erase(cnt[x].begin());
}

void push(int x, queue<int>& que)
{
	if (cnt[x].empty()) return;
	int y = a-x;
	int z = b-x;
	if (cnt[y].empty() && !cnt[z].empty()) que.push(x);
	else if (cnt[z].empty() && !cnt[y].empty()) que.push(x);
}

int main()
{
	ios::sync_with_stdio(0);

	cin >> n >> a >> b;
	for (int i = 0; i < n; ++i)
		cin >> vet[i], cnt[vet[i]].push_back(i);

	memset(who, -1, sizeof who);
	bool g = 1;
	if (a == b)
	{
		for (int i = 0; i < n; ++i)
		{
			if (vet[i] >= a) g = 0;
			int y = vet[i];
			int x = a-vet[i];
			if (cnt[x].empty() || cnt[y].empty() || (x == y && cnt[x].size() < 2)) continue;
			else mark(x, 0), mark(y, 0);
		}
	}
	else
	{
		queue<int> que;
		for (int i = 0; i < n; ++i)
		{
			int x = vet[i];
			push(x, que);
		}
		while (!que.empty() && g)
		{
			int x = que.front();
			que.pop();
			int y = a-x, z = b-x;
			if (cnt[x].empty()) continue;
			else if (!cnt[y].empty() && (x != y || cnt[x].size() >= 2)) mark(x, 0), mark(y, 0);
			else if (!cnt[z].empty() && (x != z || cnt[x].size() >= 2)) mark(x, 1), mark(z, 1);
			else continue;
			push(x, que); push(y, que); push(z, que);
			push(a-x, que); push(a-y, que); push(a-z, que);
			push(b-x, que); push(b-y, que); push(b-z, que);
		}
	}

	for (int i = 0; i < n && g; ++i)
		g &= who[i] != -1;

	if (!g) cout << "NO\n";
	else
	{
		cout << "YES\n";
		for (int i = 0; i < n; ++i)
			cout << (i?" ":"") << who[i];
		cout << lend;
	}
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>
#include <fstream>
#include <bitset>

using namespace std;

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
template <typename T> void print_container(ostream& os, const T& c) { const char* _s = " "; if (!c.empty()) { __typeof__(c.begin()) last = --c.end(); foreach (it, c) { os << *it; if (it != last) os << _s; } } }
template <typename T> ostream& operator<<(ostream& os, const vector<T>& c) { print_container(os, c); return os; }
template <typename T> ostream& operator<<(ostream& os, const set<T>& c) { print_container(os, c); return os; }
template <typename T> ostream& operator<<(ostream& os, const multiset<T>& c) { print_container(os, c); return os; }
template <typename T> ostream& operator<<(ostream& os, const deque<T>& c) { print_container(os, c); return os; }
template <typename T, typename U> ostream& operator<<(ostream& os, const map<T, U>& c) { print_container(os, c); return os; }
template <typename T, typename U> ostream& operator<<(ostream& os, const pair<T, U>& p) { os << "(" << p.first << ", " << p.second << ")"; return os; }

template <typename T> void print(T a, int n, const string& split = " ") { for (int i = 0; i < n; i++) { cout << a[i]; if (i + 1 != n) cout << split; } cout << endl; }
template <typename T> void print2d(T a, int w, int h, int width = -1, int br = 0) { for (int i = 0; i < h; ++i) { for (int j = 0; j < w; ++j) { if (width != -1) cout.width(width); cout << a[i][j] << ' '; } cout << endl; } while (br--) cout << endl; }
template <typename T> void input(T& a, int n) { for (int i = 0; i < n; ++i) cin >> a[i]; }
#define dump(v) (cerr << #v << ": " << v << endl)

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define erep(i, n) for (int i = 0; i <= (int)(n); ++i)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define clr(a, x) memset(a, x, sizeof(a))
#define sz(a) ((int)(a).size())
#define mp(a, b) make_pair(a, b)
#define ten(n) ((long long)(1e##n))

template <typename T, typename U> void upmin(T& a, const U& b) { a = min<T>(a, b); }
template <typename T, typename U> void upmax(T& a, const U& b) { a = max<T>(a, b); }
template <typename T> void uniq(T& a) { sort(a.begin(), a.end()); a.erase(unique(a.begin(), a.end()), a.end()); }
template <class T> string to_s(const T& a) { ostringstream os; os << a; return os.str(); }
template <class T> T to_T(const string& s) { istringstream is(s); T res; is >> res; return res; }
void fast_io() { cin.tie(0); ios::sync_with_stdio(false); }
bool in_rect(int x, int y, int w, int h) { return 0 <= x && x < w && 0 <= y && y < h; }

typedef long long ll;
typedef pair<int, int> pint;

const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { 1, 0, -1, 0 };

class BipatiteGraph
{
    vector<bool> used;

    bool _dfs(int v)
    {
        used[v] = true;
        for (int i = 0; i < (int)edges[v].size(); ++i)
        {
            int u = edges[v][i];
            int k = match[u];
            if (k < 0 || (!used[k] && _dfs(k)))
            {
                match[v] = u;
                match[u] = v;
                return true;
            }
        }
        return false;
    }

public:
    int n, m;
    int vertices;
    vector<vector<int> > edges;
    vector<int> match;
    int matching;

    BipatiteGraph(int n, int m)
        : used(n + m), n(n), m(m), vertices(n + m), edges(n + m), match(n + m), matching(0)
    {
        clear();
    }

    void add_edge(int a, int b)
    {
        edges[a].push_back(b + n);
        edges[b + n].push_back(a);
    }

    void clear()
    {
        fill(match.begin(), match.end(), -1);
        matching = 0;
    }

    bool dfs(int v)
    {
        fill(used.begin(), used.end(), false);
        return _dfs(v);
    }

    int update_matching()
    {
        for (int i = 0; i < n; ++i)
            if (match[i] < 0 && dfs(i))
                ++matching;
        return matching;
    }

    int max_matching()
    {
        fill(match.begin(), match.end(), -1);
        int res = 0;
        for (int i = 0; i < n; ++i)
        {
            if (match[i] < 0)
            {
                if (dfs(i))
                    ++res;
            }
        }
        return res;
    }

    vector<pair<int, int> > matching_edges()
    {
        max_matching();
        vector<pair<int, int> > edges;
        for (int i = 0; i < n; ++i)
            if (match[i] >= 0)
                edges.push_back(make_pair(i, match[i] - n));
        return edges;
    }
};
int main()
{
    fast_io();

    int n, a, b;
    cin >> n >> a >> b;
    vector<int> p(n);
    input(p, n);
    map<int, int> w;
    rep(i, n)
        w[p[i]] = i;

    BipatiteGraph g(n, n);
    rep(i, n)
    {
        if (w.count(a - p[i]))
            g.add_edge(i, w[a - p[i]]);
        if (w.count(b - p[i]))
            g.add_edge(i, w[b - p[i]]);
    }

    auto ma = g.matching_edges();
    if (sz(ma) == n)
    {
        vector<int> res(n);
        for (auto e : ma)
            res[e.first] = res[e.second] = p[e.first] + p[e.second] == a ? 0 : 1;
        cout << "YES" << endl;
        cout << res << endl;
    }
    else
        cout << "NO" << endl;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>
#include <fstream>
#include <bitset>

using namespace std;

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
template <typename T> void print_container(ostream& os, const T& c) { const char* _s = " "; if (!c.empty()) { __typeof__(c.begin()) last = --c.end(); foreach (it, c) { os << *it; if (it != last) os << _s; } } }
template <typename T> ostream& operator<<(ostream& os, const vector<T>& c) { print_container(os, c); return os; }
template <typename T> ostream& operator<<(ostream& os, const set<T>& c) { print_container(os, c); return os; }
template <typename T> ostream& operator<<(ostream& os, const multiset<T>& c) { print_container(os, c); return os; }
template <typename T> ostream& operator<<(ostream& os, const deque<T>& c) { print_container(os, c); return os; }
template <typename T, typename U> ostream& operator<<(ostream& os, const map<T, U>& c) { print_container(os, c); return os; }
template <typename T, typename U> ostream& operator<<(ostream& os, const pair<T, U>& p) { os << "(" << p.first << ", " << p.second << ")"; return os; }

template <typename T> void print(T a, int n, const string& split = " ") { for (int i = 0; i < n; i++) { cout << a[i]; if (i + 1 != n) cout << split; } cout << endl; }
template <typename T> void print2d(T a, int w, int h, int width = -1, int br = 0) { for (int i = 0; i < h; ++i) { for (int j = 0; j < w; ++j) { if (width != -1) cout.width(width); cout << a[i][j] << ' '; } cout << endl; } while (br--) cout << endl; }
template <typename T> void input(T& a, int n) { for (int i = 0; i < n; ++i) cin >> a[i]; }
#define dump(v) (cerr << #v << ": " << v << endl)

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define erep(i, n) for (int i = 0; i <= (int)(n); ++i)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define clr(a, x) memset(a, x, sizeof(a))
#define sz(a) ((int)(a).size())
#define mp(a, b) make_pair(a, b)
#define ten(n) ((long long)(1e##n))

template <typename T, typename U> void upmin(T& a, const U& b) { a = min<T>(a, b); }
template <typename T, typename U> void upmax(T& a, const U& b) { a = max<T>(a, b); }
template <typename T> void uniq(T& a) { sort(a.begin(), a.end()); a.erase(unique(a.begin(), a.end()), a.end()); }
template <class T> string to_s(const T& a) { ostringstream os; os << a; return os.str(); }
template <class T> T to_T(const string& s) { istringstream is(s); T res; is >> res; return res; }
void fast_io() { cin.tie(0); ios::sync_with_stdio(false); }
bool in_rect(int x, int y, int w, int h) { return 0 <= x && x < w && 0 <= y && y < h; }

typedef long long ll;
typedef pair<int, int> pint;

const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { 1, 0, -1, 0 };

bool check(const set<ll>& aa, ll a)
{
    for (ll i : aa)
        if (!aa.count(a - i))
            return false;
    return true;
}
ll vv;
vector<int> gao(const vector<ll>& p, const ll a, const ll b, ll v)
{
    if (v == -1)
        return {};

    const int n = p.size();
    set<ll> al(all(p));
    set<ll> aa;

    for (;;)
    {
        if (!al.count(v))
            return {};

        if (aa.count(v))
            break;

        aa.insert(v);
        v = a - v;
    }
    vv = v = -1;
    for (ll i : al)
        if (!aa.count(i))
            vv = v = i;
    set<ll> bb;
    if (v != -1)
    {
        for (;;)
        {
            if (!al.count(v))
                return {};

            if (bb.count(v))
                break;

            bb.insert(v);
            v = b - v;
        }
    }

    for (ll i : aa)
    {
        if (!al.count(i))
            return {};
    }
    for (ll i : bb)
    {
        if (!al.count(i))
            return {};
    }

    if (!check(aa, a) || !check(bb, b))
        return {};

    vector<int> res(n);
    rep(i, n)
    {
        if (aa.count(p[i]) && bb.count(p[i]))
            return {};
        else if (aa.count(p[i]))
            res[i] = 0;
        else if (bb.count(p[i]))
            res[i] = 1;
        else
            return {};
    }
    return res;
}
int main()
{
    fast_io();

    ll n, a, b;
    cin >> n >> a >> b;
    vector<ll> p(n);
    input(p, n);

    vector<int> res = gao(p, a, b, *max_element(all(p)));
    if (res.empty())
        res = gao(p, a, b, vv);
    if (res.empty())
    {
        res = gao(p, b, a, *max_element(all(p)));
        if (res.empty())
            res = gao(p, b, a, vv);

        if (res.empty())
        {
            cout << "NO" << endl;
            return 0;
        }

        rep(i, n)
            res[i] = 1 - res[i];
    }

    cout << "YES" << endl;
    cout << res << endl;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>
#include <fstream>
#include <bitset>

using namespace std;

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
template <typename T> void print_container(ostream& os, const T& c) { const char* _s = " "; if (!c.empty()) { __typeof__(c.begin()) last = --c.end(); foreach (it, c) { os << *it; if (it != last) os << _s; } } }
template <typename T> ostream& operator<<(ostream& os, const vector<T>& c) { print_container(os, c); return os; }
template <typename T> ostream& operator<<(ostream& os, const set<T>& c) { print_container(os, c); return os; }
template <typename T> ostream& operator<<(ostream& os, const multiset<T>& c) { print_container(os, c); return os; }
template <typename T> ostream& operator<<(ostream& os, const deque<T>& c) { print_container(os, c); return os; }
template <typename T, typename U> ostream& operator<<(ostream& os, const map<T, U>& c) { print_container(os, c); return os; }
template <typename T, typename U> ostream& operator<<(ostream& os, const pair<T, U>& p) { os << "(" << p.first << ", " << p.second << ")"; return os; }

template <typename T> void print(T a, int n, const string& split = " ") { for (int i = 0; i < n; i++) { cout << a[i]; if (i + 1 != n) cout << split; } cout << endl; }
template <typename T> void print2d(T a, int w, int h, int width = -1, int br = 0) { for (int i = 0; i < h; ++i) { for (int j = 0; j < w; ++j) { if (width != -1) cout.width(width); cout << a[i][j] << ' '; } cout << endl; } while (br--) cout << endl; }
template <typename T> void input(T& a, int n) { for (int i = 0; i < n; ++i) cin >> a[i]; }
#define dump(v) (cerr << #v << ": " << v << endl)

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define erep(i, n) for (int i = 0; i <= (int)(n); ++i)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define clr(a, x) memset(a, x, sizeof(a))
#define sz(a) ((int)(a).size())
#define mp(a, b) make_pair(a, b)
#define ten(n) ((long long)(1e##n))

template <typename T, typename U> void upmin(T& a, const U& b) { a = min<T>(a, b); }
template <typename T, typename U> void upmax(T& a, const U& b) { a = max<T>(a, b); }
template <typename T> void uniq(T& a) { sort(a.begin(), a.end()); a.erase(unique(a.begin(), a.end()), a.end()); }
template <class T> string to_s(const T& a) { ostringstream os; os << a; return os.str(); }
template <class T> T to_T(const string& s) { istringstream is(s); T res; is >> res; return res; }
void fast_io() { cin.tie(0); ios::sync_with_stdio(false); }
bool in_rect(int x, int y, int w, int h) { return 0 <= x && x < w && 0 <= y && y < h; }

typedef long long ll;
typedef pair<int, int> pint;

const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { 1, 0, -1, 0 };

bool check(const set<ll>& aa, ll a)
{
    for (ll i : aa)
        if (!aa.count(a - i))
            return false;
    return true;
}
vector<int> gao(const vector<ll>& p, const ll a, const ll b)
{
    const int n = p.size();
    set<ll> al(all(p));
    set<ll> aa;

    ll v = *max_element(all(p));
    for (;;)
    {
        if (!al.count(v))
            return {};

        if (aa.count(v))
            break;

        aa.insert(v);
        v = a - v;
    }
    v = -1;
    for (ll i : al)
        if (!aa.count(i))
            v = i;
    set<ll> bb;
    if (v != -1)
    {
        for (;;)
        {
            if (!al.count(v))
                return {};

            if (bb.count(v))
                break;

            bb.insert(v);
            v = b - v;
        }
    }

    for (ll i : aa)
    {
        if (!al.count(i))
            return {};
    }
    for (ll i : bb)
    {
        if (!al.count(i))
            return {};
    }

    if (!check(aa, a) || !check(bb, b))
        return {};

    vector<int> res(n);
    rep(i, n)
    {
        if (aa.count(p[i]) && bb.count(p[i]))
            return {};
        else if (aa.count(p[i]))
            res[i] = 0;
        else if (bb.count(p[i]))
            res[i] = 1;
        else
            return {};
    }
    return res;
}
int main()
{
    fast_io();

    ll n, a, b;
    cin >> n >> a >> b;
    vector<ll> p(n);
    input(p, n);

    vector<int> res = gao(p, a, b);
    if (res.empty())
    {
        res = gao(p, b, a);
        if (res.empty())
        {
            cout << "NO" << endl;
            return 0;
        }

        rep(i, n)
            res[i] = 1 - res[i];
    }

    cout << "YES" << endl;
    cout << res << endl;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>
#include <fstream>
#include <bitset>

using namespace std;

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
template <typename T> void print_container(ostream& os, const T& c) { const char* _s = " "; if (!c.empty()) { __typeof__(c.begin()) last = --c.end(); foreach (it, c) { os << *it; if (it != last) os << _s; } } }
template <typename T> ostream& operator<<(ostream& os, const vector<T>& c) { print_container(os, c); return os; }
template <typename T> ostream& operator<<(ostream& os, const set<T>& c) { print_container(os, c); return os; }
template <typename T> ostream& operator<<(ostream& os, const multiset<T>& c) { print_container(os, c); return os; }
template <typename T> ostream& operator<<(ostream& os, const deque<T>& c) { print_container(os, c); return os; }
template <typename T, typename U> ostream& operator<<(ostream& os, const map<T, U>& c) { print_container(os, c); return os; }
template <typename T, typename U> ostream& operator<<(ostream& os, const pair<T, U>& p) { os << "(" << p.first << ", " << p.second << ")"; return os; }

template <typename T> void print(T a, int n, const string& split = " ") { for (int i = 0; i < n; i++) { cout << a[i]; if (i + 1 != n) cout << split; } cout << endl; }
template <typename T> void print2d(T a, int w, int h, int width = -1, int br = 0) { for (int i = 0; i < h; ++i) { for (int j = 0; j < w; ++j) { if (width != -1) cout.width(width); cout << a[i][j] << ' '; } cout << endl; } while (br--) cout << endl; }
template <typename T> void input(T& a, int n) { for (int i = 0; i < n; ++i) cin >> a[i]; }
#define dump(v) (cerr << #v << ": " << v << endl)

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define erep(i, n) for (int i = 0; i <= (int)(n); ++i)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define clr(a, x) memset(a, x, sizeof(a))
#define sz(a) ((int)(a).size())
#define mp(a, b) make_pair(a, b)
#define ten(n) ((long long)(1e##n))

template <typename T, typename U> void upmin(T& a, const U& b) { a = min<T>(a, b); }
template <typename T, typename U> void upmax(T& a, const U& b) { a = max<T>(a, b); }
template <typename T> void uniq(T& a) { sort(a.begin(), a.end()); a.erase(unique(a.begin(), a.end()), a.end()); }
template <class T> string to_s(const T& a) { ostringstream os; os << a; return os.str(); }
template <class T> T to_T(const string& s) { istringstream is(s); T res; is >> res; return res; }
void fast_io() { cin.tie(0); ios::sync_with_stdio(false); }
bool in_rect(int x, int y, int w, int h) { return 0 <= x && x < w && 0 <= y && y < h; }

typedef long long ll;
typedef pair<int, int> pint;

const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { 1, 0, -1, 0 };

bool check(const set<ll>& aa, ll a)
{
    for (ll i : aa)
        if (!aa.count(a - i))
            return false;
    return true;
}
vector<int> gao(const vector<ll>& p, const ll a, const ll b)
{
    const int n = p.size();
    set<ll> al(all(p));
    set<ll> aa;

    ll v = *max_element(all(p));
    for (;;)
    {
        if (aa.count(v))
            break;

        aa.insert(v);
        v = a - v;
    }
    v = -1;
    for (ll i : al)
        if (!aa.count(i))
            v = i;
    set<ll> bb;
    if (v != -1)
    {
        for (;;)
        {
            if (bb.count(v))
                break;

            bb.insert(v);
            v = b - v;
        }
    }

    multiset<ll> aabb;
    for (ll i : aa)
    {
        aabb.insert(i);
        if (!al.count(i))
            return {};
    }
    for (ll i : bb)
    {
        aabb.insert(i);
        if (!al.count(i))
            return {};
    }
    if (aabb != multiset<ll>(all(p)))
        return {};

    if (sz(aa) + sz(bb) != n || !check(aa, a) || !check(bb, b))
        return {};

    vector<int> res(n);
    rep(i, n)
    {
        if (aa.count(p[i]) && bb.count(p[i]))
            return {};
        else if (aa.count(p[i]))
            res[i] = 0;
        else if (bb.count(p[i]))
            res[i] = 1;
        else
            return {};
    }
    return res;
}
int main()
{
    fast_io();

    ll n, a, b;
    cin >> n >> a >> b;
    vector<ll> p(n);
    input(p, n);

    vector<int> res = gao(p, a, b);
    if (res.empty())
    {
        res = gao(p, b, a);
        if (res.empty())
        {
            cout << "NO" << endl;
            return 0;
        }

        rep(i, n)
            res[i] = 1 - res[i];
    }

    cout << "YES" << endl;
    cout << res << endl;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>
#include <fstream>
#include <bitset>

using namespace std;

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
template <typename T> void print_container(ostream& os, const T& c) { const char* _s = " "; if (!c.empty()) { __typeof__(c.begin()) last = --c.end(); foreach (it, c) { os << *it; if (it != last) os << _s; } } }
template <typename T> ostream& operator<<(ostream& os, const vector<T>& c) { print_container(os, c); return os; }
template <typename T> ostream& operator<<(ostream& os, const set<T>& c) { print_container(os, c); return os; }
template <typename T> ostream& operator<<(ostream& os, const multiset<T>& c) { print_container(os, c); return os; }
template <typename T> ostream& operator<<(ostream& os, const deque<T>& c) { print_container(os, c); return os; }
template <typename T, typename U> ostream& operator<<(ostream& os, const map<T, U>& c) { print_container(os, c); return os; }
template <typename T, typename U> ostream& operator<<(ostream& os, const pair<T, U>& p) { os << "(" << p.first << ", " << p.second << ")"; return os; }

template <typename T> void print(T a, int n, const string& split = " ") { for (int i = 0; i < n; i++) { cout << a[i]; if (i + 1 != n) cout << split; } cout << endl; }
template <typename T> void print2d(T a, int w, int h, int width = -1, int br = 0) { for (int i = 0; i < h; ++i) { for (int j = 0; j < w; ++j) { if (width != -1) cout.width(width); cout << a[i][j] << ' '; } cout << endl; } while (br--) cout << endl; }
template <typename T> void input(T& a, int n) { for (int i = 0; i < n; ++i) cin >> a[i]; }
#define dump(v) (cerr << #v << ": " << v << endl)

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define erep(i, n) for (int i = 0; i <= (int)(n); ++i)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define clr(a, x) memset(a, x, sizeof(a))
#define sz(a) ((int)(a).size())
#define mp(a, b) make_pair(a, b)
#define ten(n) ((long long)(1e##n))

template <typename T, typename U> void upmin(T& a, const U& b) { a = min<T>(a, b); }
template <typename T, typename U> void upmax(T& a, const U& b) { a = max<T>(a, b); }
template <typename T> void uniq(T& a) { sort(a.begin(), a.end()); a.erase(unique(a.begin(), a.end()), a.end()); }
template <class T> string to_s(const T& a) { ostringstream os; os << a; return os.str(); }
template <class T> T to_T(const string& s) { istringstream is(s); T res; is >> res; return res; }
void fast_io() { cin.tie(0); ios::sync_with_stdio(false); }
bool in_rect(int x, int y, int w, int h) { return 0 <= x && x < w && 0 <= y && y < h; }

typedef long long ll;
typedef pair<int, int> pint;

const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { 1, 0, -1, 0 };

bool check(const set<ll>& aa, ll a)
{
    for (ll i : aa)
        if (!aa.count(a - i))
            return false;
    return true;
}
vector<int> gao(const vector<ll>& p, ll a, ll b)
{
    const int n = p.size();
    set<ll> aa, bb;

    ll v = p.back();
    for (;;)
    {
        if (aa.count(v))
            break;

        aa.insert(v);
        v = a - v;
    }

    rep(i, n)
        if (!aa.count(p[i]))
            bb.insert(p[i]);

    for (ll i : aa)
        if (!binary_search(all(p), i))
            return {};
    for (ll i : bb)
        if (!binary_search(all(p), i))
            return {};

    if (!check(aa, a) || !check(bb, b))
        return {};

    vector<int> res(n);
    rep(i, n)
    {
        if (aa.count(p[i]) && bb.count(p[i]))
            return {};
        else if (aa.count(p[i]))
            res[i] = 0;
        else if (bb.count(p[i]))
            res[i] = 1;
        else
            return {};
    }
    return res;
}
int main()
{
    fast_io();

    ll n, a, b;
    cin >> n >> a >> b;
    map<ll, int> ori;
    vector<ll> p(n);
    input(p, n);
    rep(i, n)
        ori[p[i]] = i;
    sort(all(p));

    vector<int> res = gao(p, a, b);
    if (res.empty())
    {
        res = gao(p, b, a);
        if (res.empty())
        {
            cout << "NO" << endl;
            return 0;
        }

        rep(i, n)
            res[i] = 1 - res[i];
    }

    vector<int> r(n);
    rep(i, n)
        r[ori[p[i]]] = res[i];
    cout << "YES" << endl;
    cout << r << endl;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>
#include <fstream>
#include <bitset>

using namespace std;

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
template <typename T> void print_container(ostream& os, const T& c) { const char* _s = " "; if (!c.empty()) { __typeof__(c.begin()) last = --c.end(); foreach (it, c) { os << *it; if (it != last) os << _s; } } }
template <typename T> ostream& operator<<(ostream& os, const vector<T>& c) { print_container(os, c); return os; }
template <typename T> ostream& operator<<(ostream& os, const set<T>& c) { print_container(os, c); return os; }
template <typename T> ostream& operator<<(ostream& os, const multiset<T>& c) { print_container(os, c); return os; }
template <typename T> ostream& operator<<(ostream& os, const deque<T>& c) { print_container(os, c); return os; }
template <typename T, typename U> ostream& operator<<(ostream& os, const map<T, U>& c) { print_container(os, c); return os; }
template <typename T, typename U> ostream& operator<<(ostream& os, const pair<T, U>& p) { os << "(" << p.first << ", " << p.second << ")"; return os; }

template <typename T> void print(T a, int n, const string& split = " ") { for (int i = 0; i < n; i++) { cout << a[i]; if (i + 1 != n) cout << split; } cout << endl; }
template <typename T> void print2d(T a, int w, int h, int width = -1, int br = 0) { for (int i = 0; i < h; ++i) { for (int j = 0; j < w; ++j) { if (width != -1) cout.width(width); cout << a[i][j] << ' '; } cout << endl; } while (br--) cout << endl; }
template <typename T> void input(T& a, int n) { for (int i = 0; i < n; ++i) cin >> a[i]; }
#define dump(v) (cerr << #v << ": " << v << endl)

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define erep(i, n) for (int i = 0; i <= (int)(n); ++i)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define clr(a, x) memset(a, x, sizeof(a))
#define sz(a) ((int)(a).size())
#define mp(a, b) make_pair(a, b)
#define ten(n) ((long long)(1e##n))

template <typename T, typename U> void upmin(T& a, const U& b) { a = min<T>(a, b); }
template <typename T, typename U> void upmax(T& a, const U& b) { a = max<T>(a, b); }
template <typename T> void uniq(T& a) { sort(a.begin(), a.end()); a.erase(unique(a.begin(), a.end()), a.end()); }
template <class T> string to_s(const T& a) { ostringstream os; os << a; return os.str(); }
template <class T> T to_T(const string& s) { istringstream is(s); T res; is >> res; return res; }
void fast_io() { cin.tie(0); ios::sync_with_stdio(false); }
bool in_rect(int x, int y, int w, int h) { return 0 <= x && x < w && 0 <= y && y < h; }

typedef long long ll;
typedef pair<int, int> pint;

const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { 1, 0, -1, 0 };

bool check(const set<ll>& aa, ll a)
{
    for (ll i : aa)
        if (!aa.count(a - i))
            return false;
    return true;
}
vector<int> gao(const vector<ll>& p, const ll a, const ll b)
{
    const int n = p.size();
    set<ll> al(all(p));
    set<ll> aa;
    set<ll> bb;

    for (ll i : p)
    {
        if (al.count(a - i))
        {
            aa.insert(i);
            aa.insert(a - i);
        }
        else if (al.count(b - i) && !aa.count(i) && !aa.count(b - i))
        {
            bb.insert(i);
            bb.insert(b - i);
        }
    }

    for (ll i : aa)
    {
        if (!al.count(i))
            return {};
    }
    for (ll i : bb)
    {
        if (!al.count(i))
            return {};
    }

    if (!check(aa, a) || !check(bb, b))
        return {};

    vector<int> res(n);
    rep(i, n)
    {
        if (aa.count(p[i]) && bb.count(p[i]))
            return {};
        else if (aa.count(p[i]))
            res[i] = 0;
        else if (bb.count(p[i]))
            res[i] = 1;
        else
            return {};
    }
    return res;
}
int main()
{
    fast_io();

    ll n, a, b;
    cin >> n >> a >> b;
    vector<ll> p(n);
    input(p, n);

    vector<int> res = gao(p, a, b);
    if (res.empty())
    {
        res = gao(p, b, a);
        if (res.empty())
        {
            cout << "NO" << endl;
            return 0;
        }

        rep(i, n)
            res[i] = 1 - res[i];
    }

    cout << "YES" << endl;
    cout << res << endl;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>
#include <fstream>
#include <bitset>

using namespace std;

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
template <typename T> void print_container(ostream& os, const T& c) { const char* _s = " "; if (!c.empty()) { __typeof__(c.begin()) last = --c.end(); foreach (it, c) { os << *it; if (it != last) os << _s; } } }
template <typename T> ostream& operator<<(ostream& os, const vector<T>& c) { print_container(os, c); return os; }
template <typename T> ostream& operator<<(ostream& os, const set<T>& c) { print_container(os, c); return os; }
template <typename T> ostream& operator<<(ostream& os, const multiset<T>& c) { print_container(os, c); return os; }
template <typename T> ostream& operator<<(ostream& os, const deque<T>& c) { print_container(os, c); return os; }
template <typename T, typename U> ostream& operator<<(ostream& os, const map<T, U>& c) { print_container(os, c); return os; }
template <typename T, typename U> ostream& operator<<(ostream& os, const pair<T, U>& p) { os << "(" << p.first << ", " << p.second << ")"; return os; }

template <typename T> void print(T a, int n, const string& split = " ") { for (int i = 0; i < n; i++) { cout << a[i]; if (i + 1 != n) cout << split; } cout << endl; }
template <typename T> void print2d(T a, int w, int h, int width = -1, int br = 0) { for (int i = 0; i < h; ++i) { for (int j = 0; j < w; ++j) { if (width != -1) cout.width(width); cout << a[i][j] << ' '; } cout << endl; } while (br--) cout << endl; }
template <typename T> void input(T& a, int n) { for (int i = 0; i < n; ++i) cin >> a[i]; }
#define dump(v) (cerr << #v << ": " << v << endl)

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define erep(i, n) for (int i = 0; i <= (int)(n); ++i)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define clr(a, x) memset(a, x, sizeof(a))
#define sz(a) ((int)(a).size())
#define mp(a, b) make_pair(a, b)
#define ten(n) ((long long)(1e##n))

template <typename T, typename U> void upmin(T& a, const U& b) { a = min<T>(a, b); }
template <typename T, typename U> void upmax(T& a, const U& b) { a = max<T>(a, b); }
template <typename T> void uniq(T& a) { sort(a.begin(), a.end()); a.erase(unique(a.begin(), a.end()), a.end()); }
template <class T> string to_s(const T& a) { ostringstream os; os << a; return os.str(); }
template <class T> T to_T(const string& s) { istringstream is(s); T res; is >> res; return res; }
void fast_io() { cin.tie(0); ios::sync_with_stdio(false); }
bool in_rect(int x, int y, int w, int h) { return 0 <= x && x < w && 0 <= y && y < h; }

typedef long long ll;
typedef pair<int, int> pint;

const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { 1, 0, -1, 0 };

bool check(const set<ll>& aa, ll a)
{
    for (ll i : aa)
        if (!aa.count(a - i))
            return false;
    return true;
}
vector<int> gao(const vector<ll>& p, const ll a, const ll b)
{
    const int n = p.size();
    set<ll> al(all(p));
    set<ll> aa;

    ll v = *max_element(all(p));
    for (;;)
    {
        if (aa.count(v))
            break;

        aa.insert(v);
        v = a - v;
    }
    v = -1;
    for (ll i : al)
        if (!aa.count(i))
            v = i;
    set<ll> bb;
    if (v != -1)
    {
        for (;;)
        {
            if (bb.count(v))
                break;

            bb.insert(v);
            v = b - v;
        }
    }

    for (ll i : aa)
    {
        if (!al.count(i))
            return {};
    }
    for (ll i : bb)
    {
        if (!al.count(i))
            return {};
    }

    if (!check(aa, a) || !check(bb, b))
        return {};

    vector<int> res(n);
    rep(i, n)
    {
//         if (aa.count(p[i]) && bb.count(p[i]))
//             return {};
//         else
        if (aa.count(p[i]))
            res[i] = 0;
        else if (bb.count(p[i]))
            res[i] = 1;
        else
            return {};
    }
    return res;
}
int main()
{
    fast_io();

    ll n, a, b;
    cin >> n >> a >> b;
    vector<ll> p(n);
    input(p, n);

    vector<int> res = gao(p, a, b);
    if (res.empty())
    {
        res = gao(p, b, a);
        if (res.empty())
        {
            cout << "NO" << endl;
            return 0;
        }

        rep(i, n)
            res[i] = 1 - res[i];
    }

    cout << "YES" << endl;
    cout << res << endl;
}