codeparrot/codecomplex huggingface dataset:
// Problem: 468_B. Two Sets
// Time complexity: linear
import java.io.*;
import java.util.*;
public class CF_468B {
    public static void main(String[] args) throws IOException {
        new CF_468B().solve();
    }
    
    int root(int[] father, int a){
        if (father[a]==a) return a;
        else return father[a]=root(father, father[a]);
    }
    void unite(int[] father, int a, int b){
        father[root(father, a)]=root(father, b);
    }
    
    
    private void solve() throws IOException{
        
        InputStream in = System.in;
        PrintStream out = System.out;
        
//        in = new FileInputStream("in.txt");
//        out = new PrintStream("out.txt");
        
        long mod=1_000_000_007;
        Scanner sc=new Scanner(in);
        int n=sc.nextInt();
        long a=sc.nextLong(), b=sc.nextLong();

        int[] father=new int[n];
        long[] p=new long[n];
        HashMap<Long, Integer> pos=new HashMap<Long, Integer>();
        for (int i=0;i<n;i++){
            father[i]=i;
            p[i]=sc.nextLong();
            pos.put(p[i],i);
        }        
        for (int i=0;i<n;i++){
            if (pos.containsKey(a-p[i])) unite(father,i,pos.get(a-p[i]) );
            if (pos.containsKey(b-p[i])) unite(father,i,pos.get(b-p[i]) );
        }
        boolean[] canA=new boolean[n],
                canB=new boolean[n];
        Arrays.fill(canA,true);
        Arrays.fill(canB,true);
        for (int i=0;i<n;i++){
            if (!pos.containsKey(a-p[i]) || 
                    root(father, i)!=root(father, pos.get(a-p[i]))) 
                canA[root(father, i)]=false;
            if (!pos.containsKey(b-p[i]) || 
                    root(father, i)!=root(father, pos.get(b-p[i]))) 
                canB[root(father, i)]=false;
            if (!canA[root(father,i)] && !canB[root(father,i)]){
                out.println("NO");
                return;                    
            }
        }
        out.println("YES");
        for (int i=0;i<n;i++)
            if (canA[root(father, i)])
                out.print("0 ");
            else
                out.print("1 ");
            
                
    }
}
// Problem: 468_B. Two Sets
// Time complexity: linear
import java.io.BufferedInputStream;
import java.io.BufferedWriter;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Map.Entry;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {

    public static void main(String[] args) {

        Scanner in = new Scanner(new BufferedInputStream(System.in));
        PrintWriter out = new PrintWriter(new BufferedWriter(
                new OutputStreamWriter(System.out)));

        while (in.hasNext()) {
            int n = in.nextInt(), a = in.nextInt(), b = in.nextInt(), c = 0;
            int[] p = new int[n];

            TreeMap<Integer, Integer> map = new TreeMap<Integer, Integer>();
            for (int i = 0; i < n; i++) {
                p[i] = in.nextInt();
                map.put(p[i], i);
            }
            
            if (a > b) {
                int t = b;
                b = a;
                a = t;
                c = 1;
            }

            boolean ok = true;
            int[] cls = new int[n];
            while (ok && map.size() > 0) {
                Entry<Integer, Integer> last = map.lastEntry();
                int v = last.getKey();
                int idx = last.getValue();
                if (map.containsKey(a - v)) {
                    cls[idx] = 0;
                    cls[map.get(a - v)] = 0;
                    map.remove(v);
                    map.remove(a -v);
                } else if (map.containsKey(b - v)) {
                    cls[idx] = 1;
                    cls[map.get(b - v)] = 1;
                    map.remove(v);
                    map.remove(b -v);
                } else 
                    ok = false;
            }

            if (!ok)
                System.out.println("NO");
            else {
                System.out.println("YES");
                for (int j = 0; j < cls.length; j++) {
                    if (j != 0)
                        System.out.print(" ");
                    System.out.print(c ^ cls[j]);
                }
                System.out.println();
            }
            out.flush();
        }
        in.close();
    }

}
// Problem: 468_B. Two Sets
// Time complexity: linear
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.StringTokenizer;
import static java.lang.Integer.*;

public class BDiv1 {
static int n; 
static int a;
static int b;
static HashMap<Integer,Integer> graphA=new HashMap<>();
static HashMap<Integer,Integer> graphB=new HashMap<>();
static int [] array;
static int [] original;
static boolean x=true;

    public static void main(String[] args) throws Exception{
        BufferedReader buf =new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st =new StringTokenizer(buf.readLine());
        n=parseInt(st.nextToken());
        a=parseInt(st.nextToken());
        b=parseInt(st.nextToken());
        st =new StringTokenizer(buf.readLine());
        array=new int[n];
        original=new int [n];
        for (int i=0;i<n;i++){
            array[i]=parseInt(st.nextToken());
            original[i]=array[i];
        }
        Arrays.sort(array);
for (int i=0;i<n;i++){
    int k= Arrays.binarySearch(array,a-array[i]);
    if (k>=0){
        graphA.put(array[i],array[k]);
        graphA.put(array[k],array[i]);
    }
}
for (int i=0;i<n;i++){
    int k= Arrays.binarySearch(array,b-array[i]);
    if (k>=0){
        graphB.put(array[i],array[k]);
        graphB.put(array[k],array[i]);
    }
    }


for (int i=0;i<n;i++){
    Integer j=graphA.get(array[i]);
    if (j!=null){
        if (graphB.containsKey(array[i]) && graphB.containsKey(j)){
            graphA.remove(array[i]);
            graphA.remove(j);
        }
        else if (graphB.containsKey(array[i]) && !graphB.containsKey(j)){
            
            graphB.remove(graphB.get(array[i]));
            graphB.remove(array[i]);
        }
        else if (!graphB.containsKey(array[i]) && graphB.containsKey(j)){
            graphB.remove(graphB.get(j));
            graphB.remove(j);
        }
        
    }
    
}

int [] res=new int [n];
for (int i=0;i<n;i++){
    if (graphA.containsKey(original[i]))res[i]=0;
    else if (graphB.containsKey(original[i])) res[i]=1;
    else {
        System.out.println("NO");
        return;
    }
}
System.out.println("YES");
for (int k:res)System.out.print(k+" ");
}

    }
// Problem: 468_B. Two Sets
// Time complexity: linear
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeSet;


public class B {
	static Set<Integer> A;
	static Set<Integer> B;
	static TreeSet<Integer> ts;
	static int a;
	static int b;
	static boolean noAns;
	public static void main(String[] args) throws Exception{
		int n = readInt();
		a = readInt();
		b = readInt();
		ts = new TreeSet<Integer>();
		int[] table = new int[n];
		for(int i = 0; i<n; i++){
			table[i] = readInt();
			ts.add(table[i]);
		}
		A = new HashSet<Integer>();
		B = new HashSet<Integer>();
		noAns = false;
		for(Integer cur:ts){
			boolean fitsA = false;
			boolean fitsB = false;
			if(A.contains(cur) || B.contains(cur)){
				continue;
			}
			if(ts.contains(a-cur)){
				fitsA = true;
			}
			if(ts.contains(b-cur)){
				fitsB = true;
			}
			if(fitsA && fitsB){
				continue;
			}
			else if(!(fitsA || fitsB)){
				noAns = true;
			}
			else if(fitsA){
				tour(cur, false);
			}
			else if(fitsB){
				tour(cur, true);
			}
		}
		for(Integer cur:ts){
			if(A.contains(cur) || B.contains(cur)){
				continue;
			}
			else{
				A.add(cur);
			}
		}
		if(!noAns){
			System.out.println("YES");
			StringBuilder sb = new StringBuilder();
			for(int i = 0; i< n; i++){
				if(A.contains(table[i])){
					sb.append("0");
				}
				else{
					sb.append("1");
				}
				sb.append(" ");
			}
			System.out.println(sb);
		}
		else{
			System.out.println("NO");
		}
	}

	static void tour(Integer cur, boolean bb){
		if(A.contains(cur) || B.contains(cur)){
			return;
		}
		if(bb){
			B.add(cur);
			B.add(b-cur);
			
			if(ts.contains(a-cur)){
				B.add(a-cur);
				if(ts.contains(b-(a-cur))){
					tour(b-(a-cur), true);
				}
				else{
					noAns = true;
				}
			}			
			if(ts.contains(a-(b-cur))){
				B.add(a-(b-cur));
				if(ts.contains(b-(a-(b-cur)))){
					tour(b-(a-(b-cur)), true);
				}
				else{
					noAns = true;
				}
			}
		}
		else{
			A.add(cur);
			A.add(a-cur);
			if(ts.contains(b-cur)){
				A.add(b-cur);
				if(ts.contains(a-(b-cur))){
					tour(a-(b-cur), false);
				}
				else{
					noAns = true;
				}
			}
			if(ts.contains(b-(a-cur))){
				A.add(b-(a-cur));
				if(ts.contains(a-(b-(a-cur)))){
					tour(a-(b-(a-cur)), false);
				}
				else{
					noAns = true;
				}
			}
		}
	}

	static BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
	static StringTokenizer st = new StringTokenizer(" ");
	static String readString() throws Exception{
		while(!st.hasMoreTokens()){
			st = new StringTokenizer(stdin.readLine());
		}
		return st.nextToken();
	}
	static int readInt() throws Exception {
		return Integer.parseInt(readString());
	}
	static long readLong() throws Exception {
		return Long.parseLong(readString());
	}
}
// Problem: 468_B. Two Sets
// Time complexity: linear
import java.util.*;
import java.io.*;
public class B {
    public static PrintStream out = System.out;
    public static InputReader in = new InputReader(System.in);
    static class Node implements Comparable<Node> {
        int res;
        Node(int pp) {
            p = pp;
        }
        int p;
        @Override
        public int compareTo(Node n) {
            return Integer.compare(p, n.p);
        }
        @Override
        public boolean equals(Object o) {
            return p == ((Node) o).p;
        }
    }
    public static void main(String args[]) {
        int N, a, b;
        N = in.nextInt();
        int[] label;
        a = in.nextInt();
        b = in.nextInt();
        if (a < b) {
            label = new int[] {0, 1};
        } else {
            int tmp = a;
            a = b;
            b = tmp;
            label = new int[] {1, 0};
        }
        Node[] nodes = new Node[N];
        for (int i = 0; i < N; i++) {
            nodes[i] = new Node(in.nextInt());
        }
        TreeSet<Node> ts = new TreeSet<>();
        for (int i = 0; i < N; i++) {
            ts.add(nodes[i]);
        }
        while (!ts.isEmpty()) {
            Node n = ts.first();
            Node an = new Node(a - n.p);
            Node bn = new Node(b - n.p);
            SortedSet<Node> ats = ts.tailSet(an);
            SortedSet<Node> bts = ts.tailSet(bn);
            Node an2 = ats.isEmpty() ? null : ats.first();
            Node bn2 = bts.isEmpty() ? null : bts.first();
            Node n2 = null;
            int l = 0;
            if (bn2 != null && bn2.equals(bn)) {
                n2 = bn2;
                l = label[1];
            } else if (an2 != null && an2.equals(an)) {
                n2 = an2;
                l = label[0];
            } else {
                NO();
            }
            if (!n.equals(n2)) {
                ts.remove(n);
                n.res = l;
            }
            ts.remove(n2);
            n2.res = l;
        }
        out.println("YES");
        for (int i = 0; i < nodes.length; i++) {
            if (i != 0) out.print(" ");
            out.print(nodes[i].res);
        }
        out.println();
    }
    static void NO() {
        out.println("NO");
        System.exit(0);
    }
}
class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;
    public InputReader(InputStream stream) {
	reader = new BufferedReader(new InputStreamReader(stream), 32768);
	tokenizer = null;
    }
    public String next() {
	while (tokenizer == null || !tokenizer.hasMoreTokens()) {
	    try {
		tokenizer = new StringTokenizer(reader.readLine());
	    } catch (IOException e) {
		throw new RuntimeException(e);
	    }
	}
	return tokenizer.nextToken();
    }
    public double nextDouble() {
	return Double.parseDouble(next());
    }
    public long nextLong() {
	return Long.parseLong(next());
    }
    public int nextInt() {
	return Integer.parseInt(next());
    }
}
// Problem: 468_B. Two Sets
// Time complexity: linear
import java.io.*;
import java.util.*;

public class Main {

	static BufferedReader reader;
	static StringTokenizer tokenizer;
	static PrintWriter writer;

	static int nextInt() throws NumberFormatException, IOException {
		return Integer.parseInt(nextToken());
	}

	static long nextLong() throws NumberFormatException, IOException {
		return Long.parseLong(nextToken());
	}

	static double nextDouble() throws NumberFormatException, IOException {
		return Double.parseDouble(nextToken());
	}

	static String nextToken() throws IOException {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			tokenizer = new StringTokenizer(reader.readLine());
		}
		return tokenizer.nextToken();
	}

	public static void main(String[] args) throws IOException {
		reader = new BufferedReader(new InputStreamReader(System.in));
		writer = new PrintWriter(System.out);
		pineapple();
		reader.close();
		writer.close();
	}

	static void pineapple() throws NumberFormatException, IOException {
		int n = nextInt();
		int a = nextInt();
		int b = nextInt();
		TreeSet<Integer> al = new TreeSet<Integer>();
		TreeMap<Integer, Integer> mp = new TreeMap<Integer, Integer>();
		int[] ans = new int[n];
		Arrays.fill(ans, -1);
		TreeSet<Integer> used = new TreeSet<Integer>();
		int[] mas = new int[n];

		for (int i = 0; i < n; i++) {
			int t = nextInt();
			al.add(t);
			mas[i] = t;
			mp.put(t, i);
		}

		for (int st : al) {
			if (used.contains(st))
				continue;

			{
				int pr = st;
				int cc = -1;
				TreeSet<Integer> u2 = new TreeSet<Integer>();
				u2.add(pr);
				if (al.contains(a - pr) && !u2.contains(a - pr))
					cc = a - pr;
				else if (al.contains(b - pr) && !u2.contains(a - pr))
					cc = b - pr;
				if (cc != -1) {
					u2.add(cc);
					boolean bGo = true;
					while (bGo) {
						bGo = false;
						int nxt = -1;
						if (al.contains(a - cc) && !u2.contains(a - cc))
							nxt = a - cc;
						else if (al.contains(b - cc) && !u2.contains(b - cc))
							nxt = b - cc;
						if (nxt != -1) {
							bGo = true;
							u2.add(nxt);
							cc = nxt;
							pr = cc;
						}
					}
					st = cc;
				}
			}

			int x = st;
			while (x != -1) {
				int curr = x;
				used.add(curr);
				x = -1;
				int next1 = a - curr;
				if (al.contains(next1)) {
					if (!used.contains(next1)) {
						x = next1;
						int ci = mp.get(curr);
						int ni = mp.get(next1);
						if (ans[ci] == -1 && ans[ni] == -1) {
							ans[ni] = 0;
							ans[ci] = 0;
						}
					}
				}
				int next2 = b - curr;
				if (al.contains(next2)) {
					if (!used.contains(next2)) {
						x = next2;
						int ci = mp.get(curr);
						int ni = mp.get(next2);
						if (ans[ci] == -1 && ans[ni] == -1) {
							ans[ni] = 1;
							ans[ci] = 1;
						}
					}
				}
			}
		}

		for (int i = 0; i < n; i++) {
			if (ans[i] == -1) {
				if (2 * mas[i] == a) {
					ans[i] = 0;
					continue;
				}
				if (2 * mas[i] == b) {
					ans[i] = 1;
					continue;
				}
				writer.println("NO");
				return;
			}
		}

		writer.println("YES");
		for (int i = 0; i < n; i++) {
			writer.print(ans[i] + " ");
		}
	}
}
// Problem: 468_B. Two Sets
// Time complexity: linear
import java.io.*;
import java.util.*;

public class Pr468B {
	public static void main(String[] args) throws IOException {
		new Pr468B().run();
	}

	BufferedReader in;
	PrintWriter out;
	StringTokenizer st;

	String nextToken() throws IOException {
		while (st == null || !st.hasMoreTokens()) {
			st = new StringTokenizer(in.readLine());
		}
		return st.nextToken();
	}

	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	void run() throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out, true);
		solve();
		out.flush();
	}

	int[] which;
	boolean[] was;
	int[] pa;
	int[] pb;

	void dfs(int i, boolean fa) {
		was[i] = true;
		if (fa) {
			if (pa[i] == -1) {
				out.println("NO");
				out.flush();
				System.exit(0);
			}
			which[i] = 0;
			which[pa[i]] = 0;
			if (pb[pa[i]] != -1 && !was[pb[pa[i]]]) {
				dfs(pb[pa[i]], fa);
			}
		} else {
			if (pb[i] == -1) {
				out.println("NO");
				out.flush();
				System.exit(0);
			}
			which[i] = 1;
			which[pb[i]] = 1;
			if (pa[pb[i]] != -1 && !was[pa[pb[i]]]) {
				dfs(pa[pb[i]], fa);
			}
		}
	}

	void solve() throws IOException {
		int n = nextInt();
		int a = nextInt();
		int b = nextInt();
		int[] p = new int[n];
		HashMap<Integer, Integer> allNums = new HashMap<Integer, Integer>();
		for (int i = 0; i < n; i++) {
			p[i] = nextInt();
			if (p[i] >= Math.max(a, b)) {
				out.println("NO");
				return;
			}
			allNums.put(p[i], i);
		}
		pa = new int[n];
		pb = new int[n];
		Arrays.fill(pa, -1);
		Arrays.fill(pb, -1);
		which = new int[n];
		Arrays.fill(which, -1);
		for (int i = 0; i < n; i++) {
			if (pa[i] == -1 && allNums.containsKey(a - p[i])) {
				pa[i] = allNums.get(a - p[i]);
				pa[pa[i]] = i;
			}
			if (pb[i] == -1 && allNums.containsKey(b - p[i])) {
				pb[i] = allNums.get(b - p[i]);
				pb[pb[i]] = i;
			}
			if (pa[i] == -1 && pb[i] == -1) {
				out.println("NO");
				return;
			}
		}
		was = new boolean[n];
		for (int i = 0; i < n; i++) {
			if (!was[i] && pa[i] == -1) {
				dfs(i, false);
			} else if (!was[i] && pb[i] == -1) {
				dfs(i, true);
			}
		}
		for (int i = 0; i < n; i++) {
			if (!was[i]) {
				dfs(i, true);
			}
		}
		out.println("YES");
		for (int i = 0; i < n; i++) {
			out.print(which[i] + " ");
		}
	}
}
// Problem: 468_B. Two Sets
// Time complexity: linear

import java.io.BufferedInputStream;
import java.io.BufferedWriter;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Map.Entry;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {

	public static void main(String[] args) {

		Scanner in = new Scanner(new BufferedInputStream(System.in));
		PrintWriter out = new PrintWriter(new BufferedWriter(
				new OutputStreamWriter(System.out)));

		while (in.hasNext()) {
			int n = in.nextInt(), a = in.nextInt(), b = in.nextInt(), c = 0;
			int[] p = new int[n];

			TreeMap<Integer, Integer> map = new TreeMap<Integer, Integer>();
			for (int i = 0; i < n; i++) {
				p[i] = in.nextInt();
				map.put(p[i], i);
			}
			
			if (a > b) {
				int t = b;
				b = a;
				a = t;
				c = 1;
			}

			boolean ok = true;
			int[] cls = new int[n];
			while (ok && map.size() > 0) {
				Entry<Integer, Integer> last = map.lastEntry();
				int v = last.getKey();
				int idx = last.getValue();
				if (map.containsKey(a - v)) {
					cls[idx] = 0;
					cls[map.get(a - v)] = 0;
					map.remove(v);
					map.remove(a -v);
				} else if (map.containsKey(b - v)) {
					cls[idx] = 1;
					cls[map.get(b - v)] = 1;
					map.remove(v);
					map.remove(b -v);
				} else 
					ok = false;
			}

			if (!ok)
				System.out.println("NO");
			else {
				System.out.println("YES");
				for (int j = 0; j < cls.length; j++) {
					if (j != 0)
						System.out.print(" ");
					System.out.print(c ^ cls[j]);
				}
				System.out.println();
			}
			out.flush();
		}
		in.close();
	}

}
// Problem: 468_B. Two Sets
// Time complexity: linear
import java.util.*;
import java.io.*;

public class Main {

	BufferedReader in;
	StringTokenizer str = null;
	PrintWriter out;
	
	private String next() throws Exception{
		while (str == null || !str.hasMoreElements())
			str = new StringTokenizer(in.readLine());
		return str.nextToken();
	}
	
	private int nextInt() throws Exception{
		return Integer.parseInt(next());
	}
	
	private long nextLong() throws Exception{
		return Long.parseLong(next());
	}
	
	private double nextDouble() throws Exception{
		return Double.parseDouble(next());
	}

	Map<Integer, Integer> map;
	int []p, rank;

	public void run() throws Exception{
		in =  new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);

		map = new HashMap<Integer, Integer>();

		int n = nextInt();
		int x = nextInt(), y = nextInt();
		int []a = new int[n];
		p = new int[n];
		for(int i = 1; i < n; ++i) p[i] = i;
		rank = new int[n];

		for(int i = 0; i < n; ++i) {
			a[i] = nextInt();
			map.put(a[i], i);
		}
		int mask[] = new int[n];
		for(int i = 0; i < n; ++i) {
			if (map.containsKey(x - a[i])) {
				union(map.get(x - a[i]), i);
				mask[i] |= 1;	
			} 
			if (map.containsKey(y - a[i])) {
				union(map.get(y - a[i]), i);
				mask[i] |= 2;
			} 
		}

		int []b = new int[n];
		Arrays.fill(b, 3);
		for(int i = 0; i < n; ++i) b[find(i)] &= mask[i];
		for(int i = 0; i < n; ++i) {
			if (b[i] == 0) {
				out.println("NO");
				out.close();
				return;
			}
		}

		out.println("YES");
		for(int i = 0; i < n; ++i) {
			out.print((b[find(i)] & 1) == 1 ? 0 : 1);
			if (i != n - 1) out.print(" ");
		}
		out.println();
		out.close();
	}

	private int find(int x) {
		if (x != p[x])
			return p[x] = find(p[x]);
		return x;
	}
	private void union(int a, int b) {
		a = find(a);
		b = find(b);
		if (rank[a] < rank[b]) {
			int tmp = a;
			a = b;
			b = tmp;
		}
		p[b] = a;
		if (rank[a] == rank[b]) ++rank[a];
	}
		
	public static void main(String[] args) throws Exception{
		new Main().run();
	}
}
// Problem: 468_B. Two Sets
// Time complexity: linear
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

public class Main {
	int work(int x){
		if(x%2==0)return x+1;
		else return x-1;
	}
	static int N = 200050;
	class Node implements Comparable <Node>{
		int x, id;
		Node(int x, int id){
			this.x = x; this.id = id;
		}
		public int compareTo(Node o){
			return Integer.compare(x, o.x);
		}
		public String toString(){
			return id + "=" + x;
		}
	}
	class Edge{
		int from, to, nex;
		Edge (int from, int to, int nex){
			this.from = from;
			this.to = to;
			this.nex = nex;
		}
	}
	Edge[] edge = new Edge[N*10];
	int[] head = new int[N];
	int edgenum;  
	void addedge(int u, int v){  
	    Edge E = new Edge(u, v, head[u]);  
	    edge[edgenum] = E;  
	    head[u] = edgenum ++;  
	}  
	
	int n;
	int[] p = new int[N], ans = new int[N];
	int a, b, max;
    Map<Integer, Integer> map = new HashMap();
    boolean match(int x, int y, int col){
    	int P = map.get(x);
    	if(map.containsKey(y-x) == false)
    		return false;
    	int Q = map.get(y - x);
    	if(ans[Q] == -1 || x * 2 == y){
    		ans[Q] = ans[P] = col;
    	}
    	else {
    		if(match(a+b-2*y+x, y, col))
    			ans[Q] = ans[P] = col; 		
    		else return false;
    	}
    	return true;
    }
    boolean solve(){
    	if(max >= a && max >= b)return false;
    	for(int i = 1; i <= n; i++)
    		if(ans[i] == -1)
    		{
    			if(match(p[i], a, 0)==false && match(p[i], b, 1) == false)
    				return false;
    		}    	
    	return true;
    }
	void init(){
		n = cin.nextInt();
		a = cin.nextInt(); b = cin.nextInt();
		max = 0;
		for(int i = 1; i <= n; i++){
			ans[i] = -1;
			p[i] = cin.nextInt();
			map.put(p[i], i);
			if(p[i] > max) max = p[i];
		}
	}
	public void work(){
		init();
		if(solve()){
			out.println("YES");
			for(int i = 1; i <= n; i++)out.print(ans[i]+" "); out.println();
		}
		else 
			out.println("NO");
	}
	Main() {
        cin = new Scanner(System.in);  
        out = new PrintWriter(System.out);
    }  
    public static void main(String[] args) {
        Main e = new Main();  
        e.work();
        out.close();
    }
    public Scanner cin;
    public static PrintWriter out;
}