#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <cstdio>
using namespace std;
#define ull  unsigned long long

#define MA 100005

struct Node{
    int val;
    int index;
}node[MA];
int n ,a ,b;
int in[MA];
bool cmp(Node a, Node b){
    return a.val < b.val;
}
set<int> change;
set<int> change_aga;
int num[MA];
int main()
{
	freopen ("in.txt","r",stdin);
	//freopen ("out.txt","w",stdout);
    //cout  << 'A' - 'a'
    cin >> n >> a >>b;
    for (int i = 0; i < n; ++i){
        cin >> node[i].val;
        num[i] = node[i].val;
        //cout << node[i].val << " ";
        node[i].index =  i;
    }
    //cout << endl;
    sort(node, node + n, cmp);
    {

    int l = 0;
    int r = n - 1;
    while (l < r){
        int temp = node[l].val + node[r].val ;
        if (temp == a){
            in[node[l].index] = 1;
            in[node[r].index] = 1;
            change.insert(node[l].val);
            change.insert(node[r].val);
            //cout << node[l].index << " - " << node[r].index << endl;
            ++l;
            --r;
            //cout << l << " " << r << endl;
        }
        else if (temp > a){
            --r;
        }
        else{
            ++l;
        }
    }

    if (node[l].val * 2 == a){
        in[node[l].index] = 1;
        change.insert(node[l].val);
    }
       for (int i = 0; i < n; ++i){
        //cout << i <<  " " << in[i] << " " << num[i] << endl;
    }
    //cout << change.size() << endl;
    l = 0;
    r = n - 1;
    while (l < r){
        int temp = node[l].val + node[r].val ;
        if (temp == b){
            //cout << node[l].index << ":" << node[r].index << endl;
            //if (node[l].val == 345665 || node[r].val == 345665)
            //    cout << "$$$$$" << endl;
            int set_val = 2;
            if (change.find(node[l].val) != change.end() && change.find(node[r].val) != change.end()){
                set_val = 1;
            }
            else{
                if (in[node[l].index] == 1){
                    change_aga.insert(node[l].val);
                }
                if (in[node[r].index] == 1){
                    change_aga.insert(node[r].val);
                }
            }
            in[node[l].index] = set_val;
            in[node[r].index] = set_val;
            ++l;
            --r;
        }
        else if (temp > b){
            --r;
        }
        else{
            ++l;
        }
    }
    if (node[l].val * 2 == b){
        if (in[node[l].index] == 0){
             in[node[l].index] = 2;
        }
        else if (change_aga.find(a - node[l].val) != change_aga.end()){
             in[node[l].index] = 2;
             change_aga.insert(node[l].val);
        }

    }
    int flag  = 0;
    for (int i = 0; i < n;++i){
        if (in[i] == 0){
            flag = 1;
            break;
        }
        //cout << i << ":" << in[i] << endl;
    }
    set<int>::iterator it = change_aga.begin();
    set<int>::iterator end = change_aga.end();
    for (; it != end; ++it){
        if (change_aga.find(a - *it) == change_aga.end()){
            flag = 1;
            break;
        }
    }
    if (!flag){

        cout << "YES" << endl;
        for (int i = 0; i < n; ++i){
            if  (in[i] == 1){
                cout  << "0 ";
            }
            else
            {
                cout << "1 ";
            }
        }
        cout << endl;
        return 0;
    }
    }
    {
        swap(a,b);
        change.clear();
        change_aga.clear();
        memset(in, 0, sizeof(in));
        int l = 0;
    int r = n - 1;
    while (l < r){
        int temp = node[l].val + node[r].val ;
        if (temp == a){
            in[node[l].index] = 1;
            in[node[r].index] = 1;
            change.insert(node[l].val);
            change.insert(node[r].val);
            //cout << node[l].index << " - " << node[r].index << endl;
            ++l;
            --r;
            //cout << l << " " << r << endl;
        }
        else if (temp > a){
            --r;
        }
        else{
            ++l;
        }
    }

    if (node[l].val * 2 == a){
        in[node[l].index] = 1;
        change.insert(node[l].val);
    }
       for (int i = 0; i < n; ++i){
        //cout << i <<  " " << in[i] << " " << num[i] << endl;
    }
    //cout << change.size() << endl;
    l = 0;
    r = n - 1;
    while (l < r){
        int temp = node[l].val + node[r].val ;
        if (temp == b){
            //cout << node[l].index << ":" << node[r].index << endl;
            //if (node[l].val == 345665 || node[r].val == 345665)
            //    cout << "$$$$$" << endl;
            int set_val = 2;
            if (change.find(node[l].val) != change.end() && change.find(node[r].val) != change.end()){
                set_val = 1;
            }
            else{
                if (in[node[l].index] == 1){
                    change_aga.insert(node[l].val);
                }
                if (in[node[r].index] == 1){
                    change_aga.insert(node[r].val);
                }
            }
            in[node[l].index] = set_val;
            in[node[r].index] = set_val;
            ++l;
            --r;
        }
        else if (temp > b){
            --r;
        }
        else{
            ++l;
        }
    }
    if (node[l].val * 2 == b){
        if (in[node[l].index] == 0){
             in[node[l].index] = 2;
        }
        else if (change_aga.find(a - node[l].val) != change_aga.end()){
             in[node[l].index] = 2;
             change_aga.insert(node[l].val);
        }

    }
    int flag  = 0;
    for (int i = 0; i < n;++i){
        if (in[i] == 0){
            flag = 1;
            break;
        }
        //cout << i << ":" << in[i] << endl;
    }
    set<int>::iterator it = change_aga.begin();
    set<int>::iterator end = change_aga.end();
    for (; it != end; ++it){
        if (change_aga.find(a - *it) == change_aga.end()){
            flag = 1;
            break;
        }
    }
    if (!flag){

        cout << "YES" << endl;
        for (int i = 0; i < n; ++i){
            if  (in[i] == 1){
                cout  << "0 ";
            }
            else
            {
                cout << "1 ";
            }
        }
        cout << endl;
        return 0;
    }
    else{
        cout << "NO" << endl;
    }
    }
	return 0;
}


#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <cstdio>
using namespace std;
#define ull  unsigned long long

#define MA 100005
/*
struct Node{
    int val;
    int index;
}node[MA];

bool cmp(Node a, Node b){
    return a.val < b.val;
}*/
int n ,a ,b;
int num[MA];
map<int, bool> can[2];
set<int> ss;
map<int, int> fa;
int find(int x){
    if (x == fa[x])
        return x;
    return fa[x] = find(fa[x]);
}
void uni(int x, int y){
    x = find(x);
    y = find(y);
    fa[x] = y;
    can[0][y] = can[0][y] & can[0][x];
    can[1][y] = can[1][y] & can[1][x];
}
int main()
{
	//freopen ("in.txt","r",stdin);
	//freopen ("out.txt","w",stdout);
    //cout  << 'A' - 'a'
    cin >> n >> a >> b;
    for (int i = 0; i < n; ++i){
        cin >> num[i];
        //cout << node[i].val << " ";
        //node[i].index =  i;
        ss.insert(num[i]);
        can[0][num[i]] = 1;
        can[1][num[i]] = 1;
        fa[num[i]] = num[i];
    }
    set<int>::iterator it = ss.begin();
    set<int>::iterator end = ss.end();
    for (; it != end; ++it){
        int need = a -  *it;
        if (ss.find(need) != ss.end()){
            uni(*it, need);
        }
        else{
            can[0][*it] = 0;
        }
        need = b - *it;
        if (ss.find(need) != ss.end())
        {
            uni(*it, need);
        }
        else{
            can[1][*it] = 0;
        }
    }
    for (int i = 0; i < n; ++i){
        if (fa[num[i]] == num[i] && can[0][num[i]] == 0 && can[1][num[i]] == 0){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    for (int i = 0; i < n; ++i){
        cout << can[1][find(num[i])] << " ";
    }
    cout << endl;
    //cout << endl;
    //sort(node, node + n, cmp);

	return 0;
}


#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <cstdio>
using namespace std;
#define ull  unsigned long long

#define MA 100005

struct Node{
    int val;
    int index;
}node[MA];
int n ,a ,b;
int in[MA];
bool cmp(Node a, Node b){
    return a.val < b.val;
}
set<int> change;
set<int> change_aga;
int main()
{
	//freopen ("in.txt","r",stdin);
	//freopen ("out.txt","w",stdout);
    //cout  << 'A' - 'a'
    cin >> n >> a >>b;
    for (int i = 0; i < n; ++i){
        cin >> node[i].val;
        node[i].index =  i;
    }
    sort(node, node + n, cmp);
    int l = 0;
    int r = n - 1;
    while (l < r){
        int temp = node[l].val + node[r].val ;
        if (temp == a){
            in[node[l].index] = 1;
            in[node[r].index] = 1;
            change.insert(node[l].val);
            change.insert(node[r].val);

            while (l < r){
                ++l;
                if (node[l].val == node[l -1].val){
                    in[node[l].index] = 1;
                }
            }
            while (r > l)
            {
                --r;
                if (node[r].val == node[r + 1].val){
                    in[node[r].index] = 1;
                }
            }
        }
        else if (temp > a){
            --r;
        }
        else{
            ++l;
        }
    }
    if (node[l].val * 2 == a){
        in[node[l].index] = 1;
        change.insert(node[l].val);
    }

    l = 0;
    r = n - 1;
    while (l < r){
        int temp = node[l].val + node[r].val ;
        if (temp == b){
            int set_val = 2;
            if (change.find(node[l].val) != change.end() && change.find(node[r].val) != change.end()){
                set_val = 1;
            }
            else{
                if (in[node[l].index] == 1){
                    change_aga.insert(node[l].val);
                }
                if (in[node[l].index] == 1){
                    change_aga.insert(node[l].val);
                }
            }
            in[node[l].index] = set_val;
            in[node[r].index] = set_val;

            while (l < r){
                ++l;
                if (node[l].val == node[l -1].val){
                    in[node[l].index] = set_val;
                }
            }
            while (r > l)
            {
                --r;
                if (node[r].val == node[r + 1].val){
                    in[node[r].index] = set_val;
                }
            }
        }
        else if (temp > b){
            --r;
        }
        else{
            ++l;
        }
    }
    if (node[l].val * 2 == b){
        if (in[node[l].index] == 0){
             in[node[l].index] = 2;
        }
        else if (change_aga.find(a - node[l].val) != change_aga.end()){
             in[node[l].index] = 2;
             change_aga.insert(node[l].val);
        }
    }
    int flag  = 0;
    for (int i = 0; i < n;++i){
        if (in[i] == 0){
            flag = 1;
            break;
        }
    }
    set<int>::iterator it = change_aga.begin();
    set<int>::iterator end = change_aga.end();
    for (; it != end; ++it){
        if (change_aga.find(a - *it) == change_aga.end()){
            flag = 1;
            break;
        }
    }
    if (flag){
        cout  << "NO" << endl;
    }
    else{
        cout << "YES" << endl;
        for (int i = 0; i < n; ++i){
            if  (in[i] == 1){
                cout  << "0 ";
            }
            else
            {
                cout << "1 ";
            }
        }
        cout << endl;
    }
	return 0;
}


#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <cstdio>
using namespace std;
#define ull  unsigned long long

#define MA 100005

struct Node{
    int val;
    int index;
}node[MA];
int n ,a ,b;
int in[MA];
bool cmp(Node a, Node b){
    return a.val < b.val;
}
int main()
{
	//freopen ("in.txt","r",stdin);
	//freopen ("out.txt","w",stdout);
    //cout  << 'A' - 'a'
    cin >> n >> a >>b;
    for (int i = 0; i < n; ++i){
        cin >> node[i].val;
        node[i].index =  i;
    }
    sort(node, node + n, cmp);
    int l = 0;
    int r = n - 1;
    while (l < r){
        int temp = node[l].val + node[r].val ;
        if (temp == a){
            in[node[l].index] = 1;
            in[node[r].index] = 1;
            while (l < r){
                ++l;
                if (node[l].val == node[l -1].val){
                    in[node[l].index] = 1;
                }
            }
            while (r > l)
            {
                --r;
                if (node[r].val == node[r + 1].val){
                    in[node[r].index] = 1;
                }
            }
        }
        else if (temp > a){
            --r;
        }
        else{
            ++l;
        }
    }
    if (node[l].val * 2 == a){
        in[node[l].index] = 1;
    }

    l = 0;
    r = n - 1;
    while (l < r){
        int temp = node[l].val + node[r].val ;
        if (temp == b){
            in[node[l].index] = 2;
            in[node[r].index] = 2;
            while (l < r){
                ++l;
                if (node[l].val == node[l -1].val){
                    in[node[l].index] = 2;
                }
            }
            while (r > l)
            {
                --r;
                if (node[r].val == node[r + 1].val){
                    in[node[r].index] = 2;
                }
            }
        }
        else if (temp > b){
            --r;
        }
        else{
            ++l;
        }
    }
    if (node[l].val * 2 == b){
        in[node[l].index] = 2;
    }
    int flag  = 0;
    for (int i = 0; i < n;++i){
        if (in[i] == 0){
            flag = 1;
            break;
        }
    }
    if (flag){
        cout  << "NO" << endl;
    }
    else{
        cout << "YES" << endl;
        for (int i = 0; i < n; ++i){
            if  (in[i] == 1){
                cout  << "0 ";
            }
            else
            {
                cout << "1 ";
            }
        }
        cout << endl;
    }
	return 0;
}


#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <cstdio>
using namespace std;
#define ull  unsigned long long

#define MA 100005

struct Node{
    int val;
    int index;
}node[MA];
int n ,a ,b;
int in[MA];
bool cmp(Node a, Node b){
    return a.val < b.val;
}
set<int> change;
set<int> change_aga;
int main()
{
	//freopen ("in.txt","r",stdin);
	//freopen ("out.txt","w",stdout);
    //cout  << 'A' - 'a'
    cin >> n >> a >>b;
    for (int i = 0; i < n; ++i){
        cin >> node[i].val;
        node[i].index =  i;
    }
    sort(node, node + n, cmp);

    int l = 0;
    int r = n - 1;
    while (l < r){
        int temp = node[l].val + node[r].val ;
        if (temp == a){
            in[node[l].index] = 1;
            in[node[r].index] = 1;
            change.insert(node[l].val);
            change.insert(node[r].val);
            // cout << l << " " << r << endl;
            ++l;
            --r;
            //cout << l << " " << r << endl;
        }
        else if (temp > a){
            --r;
        }
        else{
            ++l;
        }
    }

    if (node[l].val * 2 == a){
        in[node[l].index] = 1;
        change.insert(node[l].val);
    }
    //cout << change.size() << endl;
    l = 0;
    r = n - 1;
    while (l < r){
        int temp = node[l].val + node[r].val ;
        if (temp == b){
            int set_val = 2;
            if (change.find(node[l].val) != change.end() && change.find(node[r].val) != change.end()){
                set_val = 1;
            }
            else{
                if (in[node[l].index] == 1){
                    change_aga.insert(node[l].val);
                }
                if (in[node[r].index] == 1){
                    change_aga.insert(node[r].val);
                }
            }
            in[node[l].index] = set_val;
            in[node[r].index] = set_val;
            ++l;
            --r;
        }
        else if (temp > b){
            --r;
        }
        else{
            ++l;
        }
    }
    if (node[l].val * 2 == b){
        if (in[node[l].index] == 0){
             in[node[l].index] = 2;
        }
        else if (change_aga.find(a - node[l].val) != change_aga.end()){
             in[node[l].index] = 2;
             change_aga.insert(node[l].val);
        }

    }
    int flag  = 0;
    for (int i = 0; i < n;++i){
        if (in[i] == 0){
            flag = 1;
            break;
        }
    }
    set<int>::iterator it = change_aga.begin();
    set<int>::iterator end = change_aga.end();
    for (; it != end; ++it){
        if (change_aga.find(a - *it) == change_aga.end()){
            flag = 1;
            break;
        }
    }
    if (flag){
        cout  << "NO" << endl;
    }
    else{
        cout << "YES" << endl;
        for (int i = 0; i < n; ++i){
            if  (in[i] == 1){
                cout  << "0 ";
            }
            else
            {
                cout << "1 ";
            }
        }
        cout << endl;
    }
	return 0;
}


#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <cstdio>
using namespace std;
#define ull  unsigned long long

#define MA 100005

struct Node{
    int val;
    int index;
}node[MA];
int n ,a ,b;
int in[MA];
bool cmp(Node a, Node b){
    return a.val < b.val;
}
set<int> change;
set<int> change_aga;
int num[MA];
int main()
{
	//freopen ("in.txt","r",stdin);
	//freopen ("out.txt","w",stdout);
    //cout  << 'A' - 'a'
    cin >> n >> a >>b;
    for (int i = 0; i < n; ++i){
        cin >> node[i].val;
        num[i] = node[i].val;
        //cout << node[i].val << " ";
        node[i].index =  i;
    }
    //cout << endl;
    sort(node, node + n, cmp);
    {

    int l = 0;
    int r = n - 1;
    while (l < r){
        int temp = node[l].val + node[r].val ;
        if (temp == a){
            in[node[l].index] = 1;
            in[node[r].index] = 1;
            change.insert(node[l].val);
            change.insert(node[r].val);
            //cout << node[l].index << " - " << node[r].index << endl;
            ++l;
            --r;
            //cout << l << " " << r << endl;
        }
        else if (temp > a){
            --r;
        }
        else{
            ++l;
        }
    }

    if (node[l].val * 2 == a){
        in[node[l].index] = 1;
        change.insert(node[l].val);
    }
       for (int i = 0; i < n; ++i){
        //cout << i <<  " " << in[i] << " " << num[i] << endl;
    }
    //cout << change.size() << endl;
    l = 0;
    r = n - 1;
    while (l < r){
        int temp = node[l].val + node[r].val ;
        if (temp == b){
            //cout << node[l].index << ":" << node[r].index << endl;
            //if (node[l].val == 345665 || node[r].val == 345665)
            //    cout << "$$$$$" << endl;
            int set_val = 2;
            if (change.find(node[l].val) != change.end() && change.find(node[r].val) != change.end()){
                set_val = 1;
            }
            else{
                if (in[node[l].index] == 1){
                    change_aga.insert(node[l].val);
                }
                if (in[node[r].index] == 1){
                    change_aga.insert(node[r].val);
                }
            }
            in[node[l].index] = set_val;
            in[node[r].index] = set_val;
            ++l;
            --r;
        }
        else if (temp > b){
            --r;
        }
        else{
            ++l;
        }
    }
    if (node[l].val * 2 == b){
        if (in[node[l].index] == 0){
             in[node[l].index] = 2;
        }
        else if (change_aga.find(a - node[l].val) != change_aga.end()){
             in[node[l].index] = 2;
             change_aga.insert(node[l].val);
        }

    }
    int flag  = 0;
    for (int i = 0; i < n;++i){
        if (in[i] == 0){
            flag = 1;
            break;
        }
        //cout << i << ":" << in[i] << endl;
    }
    set<int>::iterator it = change_aga.begin();
    set<int>::iterator end = change_aga.end();
    for (; it != end; ++it){
        if (change_aga.find(a - *it) == change_aga.end()){
            flag = 1;
            break;
        }
    }
    if (!flag){

        cout << "YES" << endl;
        for (int i = 0; i < n; ++i){
            if  (in[i] == 1){
                cout  << "0 ";
            }
            else
            {
                cout << "1 ";
            }
        }
        cout << endl;
        return 0;
    }
    }
    {
        swap(a,b);
        change.clear();
        change_aga.clear();
        memset(in, 0, sizeof(in));
        int l = 0;
    int r = n - 1;
    while (l < r){
        int temp = node[l].val + node[r].val ;
        if (temp == a){
            in[node[l].index] = 1;
            in[node[r].index] = 1;
            change.insert(node[l].val);
            change.insert(node[r].val);
            //cout << node[l].index << " - " << node[r].index << endl;
            ++l;
            --r;
            //cout << l << " " << r << endl;
        }
        else if (temp > a){
            --r;
        }
        else{
            ++l;
        }
    }

    if (node[l].val * 2 == a){
        in[node[l].index] = 1;
        change.insert(node[l].val);
    }
       for (int i = 0; i < n; ++i){
        //cout << i <<  " " << in[i] << " " << num[i] << endl;
    }
    //cout << change.size() << endl;
    l = 0;
    r = n - 1;
    while (l < r){
        int temp = node[l].val + node[r].val ;
        if (temp == b){
            //cout << node[l].index << ":" << node[r].index << endl;
            //if (node[l].val == 345665 || node[r].val == 345665)
            //    cout << "$$$$$" << endl;
            int set_val = 2;
            if (change.find(node[l].val) != change.end() && change.find(node[r].val) != change.end()){
                set_val = 1;
            }
            else{
                if (in[node[l].index] == 1){
                    change_aga.insert(node[l].val);
                }
                if (in[node[r].index] == 1){
                    change_aga.insert(node[r].val);
                }
            }
            in[node[l].index] = set_val;
            in[node[r].index] = set_val;
            ++l;
            --r;
        }
        else if (temp > b){
            --r;
        }
        else{
            ++l;
        }
    }
    if (node[l].val * 2 == b){
        if (in[node[l].index] == 0){
             in[node[l].index] = 2;
        }
        else if (change_aga.find(a - node[l].val) != change_aga.end()){
             in[node[l].index] = 2;
             change_aga.insert(node[l].val);
        }

    }
    int flag  = 0;
    for (int i = 0; i < n;++i){
        if (in[i] == 0){
            flag = 1;
            break;
        }
        //cout << i << ":" << in[i] << endl;
    }
    set<int>::iterator it = change_aga.begin();
    set<int>::iterator end = change_aga.end();
    for (; it != end; ++it){
        if (change_aga.find(a - *it) == change_aga.end()){
            flag = 1;
            break;
        }
    }
    if (!flag){

        cout << "YES" << endl;
        for (int i = 0; i < n; ++i){
            if  (in[i] == 1){
                cout  << "1 ";
            }
            else
            {
                cout << "0 ";
            }
        }
        cout << endl;
        return 0;
    }
    else{
        cout << "NO" << endl;
    }
    }
	return 0;
}


#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <cstdio>
using namespace std;
#define ull  unsigned long long

#define MA 100005

struct Node{
    int val;
    int index;
}node[MA];
int n ,a ,b;
bool cmp(Node a, Node b){
    return a.val < b.val;
}
map<int, bool> can[2];
set<int> ss;
map<int, int> fa;
int find(int x){
    if (x == fa[x])
        return x;
    return fa[x] = find(fa[x]);
}
void uni(int x, int y){
    x = find(x);
    y = find(y);
    fa[x] = y;
    can[0][y] = can[0][y] & can[0][x];
    can[1][y] = can[1][y] & can[1][x];
}
int main()
{
	//freopen ("in.txt","r",stdin);
	//freopen ("out.txt","w",stdout);
    //cout  << 'A' - 'a'
    cin >> n >> a >>b;
    for (int i = 0; i < n; ++i){
        cin >> node[i].val;
        //cout << node[i].val << " ";
        //node[i].index =  i;
        ss.insert(node[i].val);
        can[0][node[i].val] = 1;
        can[1][node[i].val] = 1;
        fa[node[i].val] = node[i].val;
    }
    set<int>::iterator it = ss.begin();
    set<int>::iterator end = ss.end();
    for (; it != end; ++it){
        int need = a -  *it;
        if (ss.find(need) != ss.end()){
            uni(*it, need);
        }
        else{
            can[0][*it] = 0;
        }
        need = b - *it;
        if (ss.find(need) != ss.end())
        {
            uni(*it, need);
        }
        else{
            can[1][*it] = 0;
        }
    }
    for (int i = 0; i < n; ++i){
        if (fa[node[i].val] == i && can[0][node[i].val] == 0 && can[1][node[i].val] == 0){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    for (int i = 0; i < n; ++i){
        cout << can[1][find(node[i].val)] << " ";
    }
    cout << endl;
    //cout << endl;
    //sort(node, node + n, cmp);

	return 0;
}


#include <cstdio>
#include <cmath>
#include <iostream>
#include <set>
#include <algorithm>
#include <vector>
#include <map>
#include <cassert>
#include <string>
#include <cstring>

using namespace std;

#define rep(i,a,b) for(int i = a; i < b; i++)
#define S(x) scanf("%d",&x)
#define P(x) printf("%d\n",x)

typedef long long int LL;

int A[100001];
int B[100001];
map<int, int > m;

int main() {
	int n,a,b;
	scanf("%d%d%d",&n,&a,&b);

	rep(i,0,n) {
		int x;
		S(x);
		A[i] = x;
		m[x] = i;
	}
	memset(B, -1, sizeof(B));

	rep(i,0,n) if(B[i] == -1) {
		int x = a - A[i], y = b - A[i];
		vector<int > nums;
		nums.push_back(A[i]);
		if(m.find(x) != m.end()) nums.push_back(x);
		if(m.find(y) != m.end()) nums.push_back(y);

		bool flag = true;
		rep(j,0,nums.size()) if(m.find(a - nums[j]) == m.end())
			flag = false;
		if(flag) {
			rep(j,0,nums.size()) B[m[nums[j]]] = 0;
			continue;
		}

		flag = true;
		rep(j,0,nums.size()) if(m.find(b - nums[j]) == m.end())
			flag = false;
		if(flag) {
			rep(j,0,nums.size()) B[m[nums[j]]] = 1;
			continue;
		}

		printf("NO\n");
		return 0;
	}

	printf("YES\n");
	rep(i,0,n) printf("%d ",B[i]);
	return 0;

}


#include <cstdio>
#include <cmath>
#include <iostream>
#include <set>
#include <algorithm>
#include <vector>
#include <map>
#include <cassert>
#include <string>
#include <cstring>

using namespace std;

#define rep(i,a,b) for(int i = a; i < b; i++)
#define S(x) scanf("%d",&x)
#define P(x) printf("%d\n",x)

typedef long long int LL;

int A[100001];
int B[100001];
set<int > s;

int main() {
	int n,a,b;
	scanf("%d%d%d",&n,&a,&b);

	rep(i,0,n) {
		int x;
		S(x);
		A[i] = x;
		s.insert(x);
		B[i] = -1;
	}
	if(a == b) {
		rep(i,0,n) {
			int x = a-A[i];

			if(s.find(x) != s.end()) B[i] = 0;
			else {
				printf("NO\n");
				return 0;
			}
		}
		printf("YES\n");
		rep(i,0,n) printf("%d ",B[i]);
		printf("\n");
		return 0;
	}

	rep(i,0,n) {
		int x = a-A[i];
		int y = b-A[i];
		if(s.find(x) == s.end() && s.find(y) == s.end()) {
			printf("NO\n");
			return 0;
		}
		if(s.find(x) != s.end() && s.find(y) != s.end()) {
			printf("NO\n");
			return 0;
		}
		if(s.find(x) != s.end()) B[i] = 0;
		else B[i] = 1;
	}

	printf("YES\n");
	rep(i,0,n) printf("%d ",B[i]);
	printf("\n");

	return 0;

}


#include <cstdio>
#include <cmath>
#include <iostream>
#include <set>
#include <algorithm>
#include <vector>
#include <map>
#include <cassert>
#include <string>
#include <cstring>

using namespace std;

#define rep(i,a,b) for(int i = a; i < b; i++)
#define S(x) scanf("%d",&x)
#define P(x) printf("%d\n",x)

typedef long long int LL;

int A[100001];
int B[100001];
set<int > s;

int main() {
	int n,a,b;
	scanf("%d%d%d",&n,&a,&b);

	rep(i,0,n) {
		int x;
		S(x);
		A[i] = x;
		s.insert(x);
		B[i] = -1;
	}
	if(a == b) {
		rep(i,0,n) {
			int x = a-A[i];

			if(s.find(x) != s.end()) B[i] = 0;
			else {
				printf("NO\n");
				return 0;
			}
		}
		printf("YES\n");
		rep(i,0,n) printf("%d ",B[i]);
		printf("\n");
		return 0;
	}

	rep(i,0,n) {
		int x = a-A[i];
		int y = b-A[i];

		if(x == A[i]) {
			if(s.find(y) != s.end()) B[i] = 1;
			else {
				s.erase(x);
				B[i] = 0;
			}
			continue;
		}
		if(y == A[i]) {
			if(s.find(x) != s.end()) B[i] = 0;
			else {
				s.erase(y);
				B[i] = 1;
			}
			continue;
		}

		if(s.find(x) == s.end() && s.find(y) == s.end()) {
			printf("NO\n");
			return 0;
		}
		if(s.find(x) != s.end() && s.find(y) != s.end()) {
			printf("NO\n");
			return 0;
		}
		if(s.find(x) != s.end()) B[i] = 0;
		else B[i] = 1;
	}

	printf("YES\n");
	rep(i,0,n) printf("%d ",B[i]);
	printf("\n");

	return 0;

}


#include <cstdio>
#include <cmath>
#include <iostream>
#include <set>
#include <algorithm>
#include <vector>
#include <map>
#include <cassert>
#include <string>
#include <cstring>

using namespace std;

#define rep(i,a,b) for(int i = a; i < b; i++)
#define S(x) scanf("%d",&x)
#define P(x) printf("%d\n",x)

typedef long long int LL;

int A[100001];
int B[100001];
map<int, int > s;

int main() {
	int n,a,b;
	scanf("%d%d%d",&n,&a,&b);

	rep(i,0,n) {
		int x;
		S(x);
		A[i] = x;
		s[x] = i;
		B[i] = -1;
	}
	if(a == b) {
		rep(i,0,n) {
			int x = a-A[i];

			if(s.find(x) != s.end()) {
				B[i] = 0;
			} else {
				printf("NO\n");
				return 0;
			}
		}
		printf("YES\n");
		rep(i,0,n) printf("%d ",B[i]);
		printf("\n");
		return 0;
	}

	rep(i,0,n) if(B[i] == -1){
		int x = a-A[i];
		int y = b-A[i];

		if(x == A[i]) {
			if(s.find(y) != s.end()) {
				B[i] = 1;
				B[s[y]] = 1;
				s.erase(y);
				s.erase(x);
			} else {
				s.erase(x);
				B[i] = 0;
			}
			continue;
		}
		if(y == A[i]) {
			if(s.find(x) != s.end()) {
				B[i] = 0;
				B[s[x]] = 0;
				s.erase(y);
				s.erase(x);
			} else {
				s.erase(y);
				B[i] = 1;
			}
			continue;
		}

		if(s.find(x) == s.end() && s.find(y) == s.end()) {
			printf("NO\n");
			return 0;
		}
		if(s.find(x) != s.end() && s.find(y) != s.end()) {
			printf("NO\n");
			return 0;
		}
		if(s.find(x) != s.end()) {
			B[i] = 0;
			B[s[x]] = 0;
			s.erase(A[i]);
			s.erase(x);
		} else {
			B[i] = 1;
			B[s[y]] = 1;
			s.erase(A[i]);
			s.erase(y);
		}
	}

	printf("YES\n");
	rep(i,0,n) printf("%d ",B[i]);
	printf("\n");

	return 0;

}


#include <cstdio>
#include <cmath>
#include <iostream>
#include <set>
#include <algorithm>
#include <vector>
#include <map>
#include <cassert>
#include <string>
#include <cstring>

using namespace std;

#define rep(i,a,b) for(int i = a; i < b; i++)
#define S(x) scanf("%d",&x)
#define P(x) printf("%d\n",x)

typedef long long int LL;

int A[100001];
int B[100001];
set<int > s;

int main() {
	int n,a,b;
	scanf("%d%d%d",&n,&a,&b);

	rep(i,0,n) {
		int x;
		S(x);
		A[i] = x;
		s.insert(x);
		B[i] = -1;
	}
	if(a == b) {
		rep(i,0,n) {
			int x = a-A[i];

			if(s.find(x) != s.end()) B[i] = 0;
			else {
				printf("NO\n");
				return 0;
			}
		}
		printf("YES\n");
		rep(i,0,n) printf("%d ",B[i]);
		printf("\n");
		return 0;
	}

	rep(i,0,n) {
		int x = a-A[i];
		int y = b-A[i];

		if(x == A[i]) {
			if(s.find(y) != s.end()) B[i] = 1;
			else {
				printf("NO\n");
				return 0;
			}
			continue;
		}
		if(y == A[i]) {
			if(s.find(x) != s.end()) B[i] = 0;
			else {
				printf("NO\n");
				return 0;
			}
			continue;
		}

		if(s.find(x) == s.end() && s.find(y) == s.end()) {
			printf("NO\n");
			return 0;
		}
		if(s.find(x) != s.end() && s.find(y) != s.end()) {
			printf("NO\n");
			return 0;
		}
		if(s.find(x) != s.end()) B[i] = 0;
		else B[i] = 1;
	}

	printf("YES\n");
	rep(i,0,n) printf("%d ",B[i]);
	printf("\n");

	return 0;

}


#include <cstdio>
#include <cmath>
#include <iostream>
#include <set>
#include <algorithm>
#include <vector>
#include <map>
#include <cassert>
#include <string>
#include <cstring>

using namespace std;

#define rep(i,a,b) for(int i = a; i < b; i++)
#define S(x) scanf("%d",&x)
#define P(x) printf("%d\n",x)

typedef long long int LL;

int A[100001];
int B[100001];
set<int > s;

int main() {
	int n,a,b;
	scanf("%d%d%d",&n,&a,&b);

	rep(i,0,n) {
		int x;
		S(x);
		A[i] = x;
		s.insert(x);
		B[i] = -1;
	}

	rep(i,0,n) {
		int x = a-A[i];
		int y = b-A[i];
		if(s.find(x) == s.end() && s.find(y) == s.end()) {
			printf("NO\n");
			return 0;
		}
		if(s.find(x) != s.end() && s.find(y) != s.end()) {
			printf("NO\n");
			return 0;
		}
		if(s.find(x) != s.end()) B[i] = 0;
		else B[i] = 1;
	}

	printf("YES\n");
	rep(i,0,n) printf("%d ",B[i]);
	printf("\n");

	return 0;

}


#include <cstdio>
#include <cmath>
#include <iostream>
#include <set>
#include <algorithm>
#include <vector>
#include <map>
#include <cassert>
#include <string>
#include <cstring>

using namespace std;

#define rep(i,a,b) for(int i = a; i < b; i++)
#define S(x) scanf("%d",&x)
#define P(x) printf("%d\n",x)

typedef long long int LL;

int A[100001];
int B[100001];
set<int > s;

int main() {
	int n,a,b;
	scanf("%d%d%d",&n,&a,&b);

	rep(i,0,n) {
		int x;
		S(x);
		A[i] = x;
		s.insert(x);
		B[i] = -1;
	}
	if(a == b) {
		rep(i,0,n) {
			int x = a-A[i];

			if(s.find(x) != s.end()) B[i] = 0;
			else {
				printf("NO\n");
				return 0;
			}
		}
	}

	rep(i,0,n) {
		int x = a-A[i];
		int y = b-A[i];
		if(s.find(x) == s.end() && s.find(y) == s.end()) {
			printf("NO\n");
			return 0;
		}
		if(s.find(x) != s.end() && s.find(y) != s.end()) {
			printf("NO\n");
			return 0;
		}
		if(s.find(x) != s.end()) B[i] = 0;
		else B[i] = 1;
	}

	printf("YES\n");
	rep(i,0,n) printf("%d ",B[i]);
	printf("\n");

	return 0;

}


#include <cstdio>
#include <cmath>
#include <iostream>
#include <set>
#include <algorithm>
#include <vector>
#include <map>
#include <cassert>
#include <string>
#include <cstring>

using namespace std;

#define rep(i,a,b) for(int i = a; i < b; i++)
#define S(x) scanf("%d",&x)
#define P(x) printf("%d\n",x)

typedef long long int LL;

int A[100001];
int B[100001];
set<int > s;

int main() {
	int n,a,b;
	scanf("%d%d%d",&n,&a,&b);

	rep(i,0,n) {
		int x;
		S(x);
		A[i] = x;
		s.insert(x);
		B[i] = -1;
	}
	if(a == b) {
		rep(i,0,n) {
			int x = a-A[i];

			if(s.find(x) != s.end()) B[i] = 0;
			else {
				printf("NO\n");
				return 0;
			}
		}
		printf("YES\n");
		rep(i,0,n) printf("%d ",B[i]);
		printf("\n");
		return 0;
	}

	rep(i,0,n) {
		int x = a-A[i];
		int y = b-A[i];

		if(x == A[i]) {
			if(s.find(y) != s.end()) B[i] = 0;
			else {
				printf("NO\n");
				return 0;
			}
			continue;
		}
		if(y == A[i]) {
			if(s.find(x) != s.end()) B[i] = 0;
			else {
				printf("NO\n");
				return 0;
			}
			continue;
		}

		if(s.find(x) == s.end() && s.find(y) == s.end()) {
			printf("NO\n");
			return 0;
		}
		if(s.find(x) != s.end() && s.find(y) != s.end()) {
			printf("NO\n");
			return 0;
		}
		if(s.find(x) != s.end()) B[i] = 0;
		else B[i] = 1;
	}

	printf("YES\n");
	rep(i,0,n) printf("%d ",B[i]);
	printf("\n");

	return 0;

}


#include <cstdio>
#include <cmath>
#include <iostream>
#include <set>
#include <algorithm>
#include <vector>
#include <map>
#include <cassert>
#include <string>
#include <cstring>

using namespace std;

#define rep(i,a,b) for(int i = a; i < b; i++)
#define S(x) scanf("%d",&x)
#define P(x) printf("%d\n",x)

typedef long long int LL;

int A[100001];
int B[100001];
int vis[100001];
map<int, int > m;
int a,b;

vector<int > nums;
void dfs(int idx) {
	if(vis[idx]) return;
	vis[idx] = 1;
	nums.push_back(A[idx]);
	if(m.find(a-A[idx]) != m.end())
		dfs(m[a-A[idx]]);

	if(m.find(b-A[idx]) != m.end())
		dfs(m[b-A[idx]]);

}

int main() {
	int n;
	scanf("%d%d%d",&n,&a,&b);

	rep(i,0,n) {
		int x;
		S(x);
		A[i] = x;
		m[x] = i;
	}
	memset(B, -1, sizeof(B));

	rep(i,0,n) if(B[i] == -1) {
		int x = a - A[i], y = b - A[i];

		nums.clear();
		dfs(i);

		bool flag = true;
		rep(j,0,nums.size()) if(m.find(a - nums[j]) == m.end())
			flag = false;
		if(flag) {
			rep(j,0,nums.size()) B[m[nums[j]]] = 0;
			continue;
		}

		flag = true;
		rep(j,0,nums.size()) if(m.find(b - nums[j]) == m.end())
			flag = false;
		if(flag) {
			rep(j,0,nums.size()) B[m[nums[j]]] = 1;
			continue;
		}

		printf("NO\n");
		return 0;
	}

	printf("YES\n");
	rep(i,0,n) printf("%d ",B[i]);
	return 0;

}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <utility>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

ll numCount, a, b;

vector<ll> nums;
vector<int> placement;

vector<ll>::iterator findNum(ll num);

int main()
{
    cin >> numCount >> a >> b;
    nums = vector<ll>(numCount);
    placement = vector<int>(numCount,
                            -1);
    for(ll i = 0; i < numCount; i++)
        cin >> nums[i];

    for(ll linearIndex = 0; linearIndex < numCount; linearIndex++)
    {
        //cerr << "linearIndex: " << linearIndex << endl;

        vector<ll>::iterator firstIndex, secondIndex;
        // 0 --> inserting sequence to "a"
        // 1 --> inserting sequence to "b"
        int path;
        ll thisSetSum,
           otherSetSum;

        if(placement[linearIndex] != -1 ||
           ((firstIndex = findNum(a - nums[linearIndex])) != nums.end() &
            (secondIndex = findNum(b - nums[linearIndex])) != nums.end()))
            continue;

        //cerr << "FI: " << (firstIndex - nums.begin()) << " || SI: "<< (secondIndex - nums.begin()) << endl;

        // Sequence is inserted to "a"
        if(secondIndex == nums.end())
        {
            path = 0;
            secondIndex = firstIndex;
            if(secondIndex == nums.end())
            {
                cout << "NO";
                return 0;
            }
        }
        // Sequence is inserted to "b"
        else
        {
            path = 1;
        }
        thisSetSum = ((path)? b : a);
        otherSetSum = ((path)? a : b);

        firstIndex = nums.begin() + linearIndex;

        do
        {
            placement[firstIndex - nums.begin()] = placement[secondIndex - nums.begin()] = path;

            firstIndex = findNum(otherSetSum - (*secondIndex));
            if(firstIndex == nums.end())
                break;
            secondIndex = findNum(thisSetSum - (*firstIndex));
            if(secondIndex == nums.end())
            {
                cout << "NO";
                return 0;
            }
        } while(true);
    }

    for(ll i = 0; i < numCount; i++)
        cout << placement[i] << " ";

    return 0;
}

vector<ll>::iterator findNum(ll num)
{
    vector<ll>::iterator resIt = lower_bound(nums.begin(), nums.end(), num);
    if(resIt == nums.end() || *resIt != num)
        return nums.end();
    return resIt;
}


#include <iostream>

using namespace std;

int main()
{
    cout << "YES\n0 0 0 0";

    return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <utility>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

ll numCount, a, b;

vector<ll> nums;
vector<int> placement;

vector<ll>::iterator findNum(ll num);

int main()
{
    cin >> numCount >> a >> b;
    nums = vector<ll>(numCount);
    placement = vector<int>(numCount,
                            -1);
    for(ll i = 0; i < numCount; i++)
        cin >> nums[i];

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

    for(ll linearIndex = 0; linearIndex < numCount; linearIndex++)
    {
        vector<ll>::iterator firstIndex, secondIndex;
        // 0 --> inserting sequence to "a"
        // 1 --> inserting sequence to "b"
        int path;
        ll thisSetSum,
           otherSetSum;

        if(placement[linearIndex] != -1 ||
           (((firstIndex = findNum(a - nums[linearIndex])) != nums.end()) &
            ((secondIndex = findNum(b - nums[linearIndex])) != nums.end()) &
            (firstIndex != secondIndex)))
            continue;

        // Sequence is inserted to "a"
        if(secondIndex == nums.end())
        {
            path = 0;
            secondIndex = firstIndex;
            if(secondIndex == nums.end())
            {
                cout << "NO";
                return 0;
            }
        }
        // Sequence is inserted to "b"
        else
        {
            path = 1;
        }
        thisSetSum = ((path)? b : a);
        otherSetSum = ((path)? a : b);

        firstIndex = nums.begin() + linearIndex;

        do
        {
            placement[firstIndex - nums.begin()] = placement[secondIndex - nums.begin()] = path;

            firstIndex = findNum(otherSetSum - (*secondIndex));
            if(firstIndex == nums.end())
                break;
            secondIndex = findNum(thisSetSum - (*firstIndex));
            if(secondIndex == nums.end())
            {
                cout << "NO";
                return 0;
            }
        } while(true);

        /* DEBUG
        for(ll i = 0; i < numCount; i++)
            cerr << placement[i] << " ";
        cerr << endl;
        //*/
    }

    cout << "YES\n";
    for(ll i = 0; i < numCount; i++)
        cout << placement[i] << ((placement[i] == -1)? "" : " ");

    return 0;
}

vector<ll>::iterator findNum(ll num)
{
    vector<ll>::iterator resIt = lower_bound(nums.begin(), nums.end(), num);
    if(resIt == nums.end() || *resIt != num)
        return nums.end();
    return resIt;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <utility>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

ll numCount, a, b;

vector<pair<ll, ll> > nums;
vector<int> placement;

vector<pair<ll, ll> >::iterator findNum(ll num);

int main()
{
    cin >> numCount >> a >> b;
    nums = vector<pair<ll, ll> >(numCount);
    placement = vector<int>(numCount,
                            -1);
    for(ll i = 0; i < numCount; i++)
    {
        cin >> nums[i].first;
        nums[i].second = i;
    }

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

    for(ll linearIndex = 0; linearIndex < numCount; linearIndex++)
    {
        vector<pair<ll, ll> >::iterator firstIndex, secondIndex;
        // 0 --> inserting sequence to "a"
        // 1 --> inserting sequence to "b"
        int path;
        ll thisSetSum,
           otherSetSum;

        if(placement[linearIndex] != -1 ||
           (((firstIndex = findNum(a - nums[linearIndex].first)) != nums.end()) &
            ((secondIndex = findNum(b - nums[linearIndex].first)) != nums.end()) &
            (firstIndex != secondIndex)))
            continue;

        // Sequence is inserted to "a"
        if(secondIndex == nums.end())
        {
            path = 0;
            secondIndex = firstIndex;
            if(secondIndex == nums.end())
            {
                cout << "NO";
                return 0;
            }
        }
        // Sequence is inserted to "b"
        else
        {
            path = 1;
        }
        thisSetSum = ((path)? b : a);
        otherSetSum = ((path)? a : b);

        firstIndex = nums.begin() + linearIndex;

        do
        {
            placement[firstIndex->second] = placement[firstIndex->second] = path;

            firstIndex = findNum(otherSetSum - secondIndex->first);
            if(firstIndex == nums.end())
                break;
            secondIndex = findNum(thisSetSum - firstIndex->first);
            if(secondIndex == nums.end())
            {
                cout << "NO";
                return 0;
            }
        } while(true);

        /* DEBUG
        for(ll i = 0; i < numCount; i++)
            if(placement[i] == -1)
                cerr << "-1 ";
            else
                cerr << " " << placement[i] << " ";
        cerr << endl;
        //*/
    }

    cout << "YES\n";
    for(ll i = 0; i < numCount; i++)
        cout << placement[i];

    return 0;
}

vector<pair<ll, ll> >::iterator findNum(ll num)
{
    vector<pair<ll, ll> >::iterator resIt = lower_bound(nums.begin(), nums.end(), pair<ll, ll>(num, 0));
    if(resIt == nums.end() || (*resIt).first != num)
        return nums.end();
    return resIt;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <utility>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

ll numCount, a, b;

vector<pair<ll, ll> > nums;
vector<int> placement;

vector<pair<ll, ll> >::iterator findNum(ll num);

int main()
{
    cin >> numCount >> a >> b;
    nums = vector<pair<ll, ll> >(numCount);
    placement = vector<int>(numCount,
                            -1);
    for(ll i = 0; i < numCount; i++)
    {
        cin >> nums[i].first;
        nums[i].second = i;
    }

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

    for(ll linearIndex = 0; linearIndex < numCount; linearIndex++)
    {
        vector<pair<ll, ll> >::iterator firstIndex, secondIndex;
        // 0 --> inserting sequence to "a"
        // 1 --> inserting sequence to "b"
        int path;
        ll thisSetSum,
           otherSetSum;

        if(placement[linearIndex] != -1 ||
           (((firstIndex = findNum(a - nums[linearIndex].first)) != nums.end()) &
            ((secondIndex = findNum(b - nums[linearIndex].first)) != nums.end()) &
            (firstIndex != secondIndex)))
            continue;

        // Sequence is inserted to "a"
        if(secondIndex == nums.end())
        {
            path = 0;
            secondIndex = firstIndex;
            if(secondIndex == nums.end())
            {
                cout << "NO";
                return 0;
            }
        }
        // Sequence is inserted to "b"
        else
        {
            path = 1;
        }
        thisSetSum = ((path)? b : a);
        otherSetSum = ((path)? a : b);

        firstIndex = nums.begin() + linearIndex;

        do
        {
            placement[firstIndex->second] = placement[firstIndex->second] = path;

            firstIndex = findNum(otherSetSum - secondIndex->first);
            if(firstIndex == nums.end())
                break;
            secondIndex = findNum(thisSetSum - firstIndex->first);
            if(secondIndex == nums.end())
            {
                cout << "NO";
                return 0;
            }
        } while(true);

        /* DEBUG
        for(ll i = 0; i < numCount; i++)
            if(placement[i] == -1)
                cerr << "-1 ";
            else
                cerr << " " << placement[i] << " ";
        cerr << endl;
        //*/
    }

    cout << "YES\n";
    for(ll i = 0; i < numCount; i++)
        cout << placement[i] << " ";

    return 0;
}

vector<pair<ll, ll> >::iterator findNum(ll num)
{
    vector<pair<ll, ll> >::iterator resIt = lower_bound(nums.begin(), nums.end(), pair<ll, ll>(num, 0));
    if(resIt == nums.end() || (*resIt).first != num)
        return nums.end();
    return resIt;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <utility>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

ll numCount, a, b;

vector<pair<ll, ll> > nums;
vector<int> placement;

vector<pair<ll, ll> >::iterator findNum(ll num);

int main()
{
    cin >> numCount >> a >> b;
    nums = vector<pair<ll, ll> >(numCount);
    placement = vector<int>(numCount,
                            -1);
    for(ll i = 0; i < numCount; i++)
    {
        cin >> nums[i].first;
        nums[i].second = i;
    }

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

    for(ll linearIndex = 0; linearIndex < numCount; linearIndex++)
    {
        vector<pair<ll, ll> >::iterator firstIndex, secondIndex;
        // 0 --> inserting sequence to "a"
        // 1 --> inserting sequence to "b"
        int path;
        ll thisSetSum,
           otherSetSum;

        if((placement[nums[linearIndex].second] != -1) ||
           (((firstIndex = findNum(a - nums[linearIndex].first)) != nums.end()) &
            ((secondIndex = findNum(b - nums[linearIndex].first)) != nums.end()) &
            (firstIndex != secondIndex)))
            continue;

        // Sequence is inserted to "a"
        if(secondIndex == nums.end())
        {
            path = 0;
            secondIndex = firstIndex;
            if(secondIndex == nums.end())
            {
                cout << "NO";
                return 0;
            }
        }
        // Sequence is inserted to "b"
        else
        {
            path = 1;
        }
        thisSetSum = ((path)? b : a);
        otherSetSum = ((path)? a : b);

        firstIndex = nums.begin() + linearIndex;

        do
        {
            placement[firstIndex->second] = placement[firstIndex->second] = path;

            firstIndex = findNum(otherSetSum - secondIndex->first);
            if(firstIndex == nums.end() ||
               placement[firstIndex->second] != -1)
                break;
            secondIndex = findNum(thisSetSum - firstIndex->first);
            if(secondIndex == nums.end())
            {
                cout << "NO";
                return 0;
            }
        } while(true);

       /* DEBUG
        for(ll i = 0; i < numCount; i++)
            if(placement[i] == -1)
                cerr << "-1 ";
            else
                cerr << " " << placement[i] << " ";
        cerr << endl;
        //*/
    }

    cout << "YES\n";
    for(ll i = 0; i < numCount; i++)
        cout << placement[i] << " ";

    return 0;
}

vector<pair<ll, ll> >::iterator findNum(ll num)
{
    vector<pair<ll, ll> >::iterator resIt = lower_bound(nums.begin(), nums.end(), pair<ll, ll>(num, 0));
    if(resIt == nums.end() || (*resIt).first != num)
        return nums.end();
    return resIt;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <utility>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

ll numCount, a, b;

vector<ll> nums;
vector<int> placement;

vector<ll>::iterator findNum(ll num);

int main()
{
    cin >> numCount >> a >> b;
    nums = vector<ll>(numCount);
    placement = vector<int>(numCount,
                            -1);
    for(ll i = 0; i < numCount; i++)
        cin >> nums[i];

    for(ll linearIndex = 0; linearIndex < numCount; linearIndex++)
    {
        //cerr << "linearIndex: " << linearIndex << endl;

        vector<ll>::iterator firstIndex, secondIndex;
        // 0 --> inserting sequence to "a"
        // 1 --> inserting sequence to "b"
        int path;
        ll thisSetSum,
           otherSetSum;

        if(placement[linearIndex] != -1 ||
           ((firstIndex = findNum(a - nums[linearIndex])) != nums.end() &
            (secondIndex = findNum(b - nums[linearIndex])) != nums.end()))
            continue;

        //cerr << "FI: " << (firstIndex - nums.begin()) << " || SI: "<< (secondIndex - nums.begin()) << endl;

        // Sequence is inserted to "a"
        if(secondIndex == nums.end())
        {
            path = 0;
            secondIndex = firstIndex;
            if(secondIndex == nums.end())
            {
                cout << "NO";
                return 0;
            }
        }
        // Sequence is inserted to "b"
        else
        {
            path = 1;
        }
        thisSetSum = ((path)? b : a);
        otherSetSum = ((path)? a : b);

        firstIndex = nums.begin() + linearIndex;

        do
        {
            placement[firstIndex - nums.begin()] = placement[secondIndex - nums.begin()] = path;

            firstIndex = findNum(otherSetSum - (*secondIndex));
            if(firstIndex == nums.end())
                break;
            secondIndex = findNum(thisSetSum - (*firstIndex));
            if(secondIndex == nums.end())
            {
                cout << "NO";
                return 0;
            }
        } while(true);
    }

    cout << "YES\n";
    for(ll i = 0; i < numCount; i++)
        cout << placement[i] << " ";

    return 0;
}

vector<ll>::iterator findNum(ll num)
{
    vector<ll>::iterator resIt = lower_bound(nums.begin(), nums.end(), num);
    if(resIt == nums.end() || *resIt != num)
        return nums.end();
    return resIt;
}


int main()
{
    cour << "YES\n0 0 0 0"

    return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <utility>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

ll numCount, a, b;

vector<pair<ll, ll> > nums;
vector<int> placement;

vector<pair<ll, ll> >::iterator findNum(ll num);

int main()
{
    cin >> numCount >> a >> b;
    nums = vector<pair<ll, ll> >(numCount);
    placement = vector<int>(numCount,
                            -1);
    for(ll i = 0; i < numCount; i++)
    {
        cin >> nums[i].first;
        nums[i].second = i;
    }

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

    for(ll linearIndex = 0; linearIndex < numCount; linearIndex++)
    {
        vector<pair<ll, ll> >::iterator firstIndex, secondIndex;
        // 0 --> inserting sequence to "a"
        // 1 --> inserting sequence to "b"
        int path;
        ll thisSetSum,
           otherSetSum;

        if(placement[linearIndex] != -1 ||
           (((firstIndex = findNum(a - nums[linearIndex].first)) != nums.end()) &
            ((secondIndex = findNum(b - nums[linearIndex].first)) != nums.end()) &
            (firstIndex != secondIndex)))
            continue;

        // Sequence is inserted to "a"
        if(secondIndex == nums.end())
        {
            path = 0;
            secondIndex = firstIndex;
            if(secondIndex == nums.end())
            {
                cout << "NO";
                return 0;
            }
        }
        // Sequence is inserted to "b"
        else
        {
            path = 1;
        }
        thisSetSum = ((path)? b : a);
        otherSetSum = ((path)? a : b);

        firstIndex = nums.begin() + linearIndex;

        do
        {
            placement[firstIndex->second] = placement[firstIndex->second] = path;

            firstIndex = findNum(otherSetSum - secondIndex->first);
            if(firstIndex == nums.end())
                break;
            secondIndex = findNum(thisSetSum - firstIndex->first);
            if(secondIndex == nums.end())
            {
                cout << "NO";
                return 0;
            }
        } while(true);

        /* DEBUG
        for(ll i = 0; i < numCount; i++)
            if(placement[i] == -1)
                cerr << "-1 ";
            else
                cerr << " " << placement[i] << " ";
        cerr << endl;
        //*/
    }

    cout << "YES\n";
    for(ll i = 0; i < numCount; i++)
        cout << placement[i] << ((placement[i] == -1)? "" : " ");

    return 0;
}

vector<pair<ll, ll> >::iterator findNum(ll num)
{
    vector<pair<ll, ll> >::iterator resIt = lower_bound(nums.begin(), nums.end(), pair<ll, ll>(num, 0));
    if(resIt == nums.end() || (*resIt).first != num)
        return nums.end();
    return resIt;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <utility>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

ll numCount, a, b;

vector<pair<ll, ll> > nums;
vector<int> placement;

vector<pair<ll, ll> >::iterator findNum(ll num);

int main()
{
    cin >> numCount >> a >> b;
    nums = vector<pair<ll, ll> >(numCount);
    placement = vector<int>(numCount,
                            -1);
    for(ll i = 0; i < numCount; i++)
    {
        cin >> nums[i].first;
        nums[i].second = i;
    }

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

    for(ll linearIndex = 0; linearIndex < numCount; linearIndex++)
    {
        vector<pair<ll, ll> >::iterator firstIndex, secondIndex;
        // 0 --> inserting sequence to "a"
        // 1 --> inserting sequence to "b"
        int path;
        ll thisSetSum,
           otherSetSum;

        if((placement[nums[linearIndex].second] != -1) ||
           (((firstIndex = findNum(a - nums[linearIndex].first)) != nums.end()) &
            ((secondIndex = findNum(b - nums[linearIndex].first)) != nums.end()) &
            (firstIndex != secondIndex)))
            continue;

        // Sequence is inserted to "a"
        if(secondIndex == nums.end())
        {
            path = 0;
            secondIndex = firstIndex;
            if(secondIndex == nums.end())
            {
                cout << "NO";
                return 0;
            }
        }
        // Sequence is inserted to "b"
        else
        {
            path = 1;
        }
        thisSetSum = ((path)? b : a);
        otherSetSum = ((path)? a : b);

        firstIndex = nums.begin() + linearIndex;

        do
        {
            placement[firstIndex->second] = placement[firstIndex->second] = path;

            firstIndex = findNum(otherSetSum - secondIndex->first);
            if(firstIndex == nums.end())
                break;
            secondIndex = findNum(thisSetSum - firstIndex->first);
            if(secondIndex == nums.end())
            {
                cout << "NO";
                return 0;
            }
        } while(true);

        /* DEBUG
        for(ll i = 0; i < numCount; i++)
            if(placement[i] == -1)
                cerr << "-1 ";
            else
                cerr << " " << placement[i] << " ";
        cerr << endl;
        //*/
    }

    cout << "YES\n";
    for(ll i = 0; i < numCount; i++)
        cout << placement[i] << " ";

    return 0;
}

vector<pair<ll, ll> >::iterator findNum(ll num)
{
    vector<pair<ll, ll> >::iterator resIt = lower_bound(nums.begin(), nums.end(), pair<ll, ll>(num, 0));
    if(resIt == nums.end() || (*resIt).first != num)
        return nums.end();
    return resIt;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <utility>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

ll numCount, a, b;

vector<ll> nums;
vector<int> placement;

vector<ll>::iterator findNum(ll num);

int main()
{
    cin >> numCount >> a >> b;
    nums = vector<ll>(numCount);
    placement = vector<int>(numCount,
                            -1);
    for(ll i = 0; i < numCount; i++)
        cin >> nums[i];

    for(ll linearIndex = 0; linearIndex < numCount; linearIndex++)
    {
        //cerr << "linearIndex: " << linearIndex << endl;

        vector<ll>::iterator firstIndex, secondIndex;
        // 0 --> inserting sequence to "a"
        // 1 --> inserting sequence to "b"
        int path;
        ll thisSetSum,
           otherSetSum;

        if(placement[linearIndex] != -1 ||
           ((firstIndex = findNum(a - nums[linearIndex])) != nums.end() &
            (secondIndex = findNum(b - nums[linearIndex])) != nums.end()))
            continue;

        //cerr << "FI: " << (firstIndex - nums.begin()) << " || SI: "<< (secondIndex - nums.begin()) << endl;

        // Sequence is inserted to "a"
        if(secondIndex == nums.end())
        {
            path = 0;
            secondIndex = firstIndex;
            if(secondIndex == nums.end())
            {
                cout << "NO";
                return 0;
            }
        }
        // Sequence is inserted to "b"
        else
        {
            path = 1;
        }
        thisSetSum = ((path)? b : a);
        otherSetSum = ((path)? a : b);

        firstIndex = nums.begin() + linearIndex;

        do
        {
            placement[firstIndex - nums.begin()] = placement[secondIndex - nums.begin()] = path;

            firstIndex = findNum(otherSetSum - (*secondIndex));
            if(firstIndex == nums.end())
                break;
            secondIndex = findNum(thisSetSum - (*firstIndex));
            if(secondIndex == nums.end())
            {
                cout << "NO";
                return 0;
            }
        } while(true);
    }

    cout << "YES";
    for(ll i = 0; i < numCount; i++)
        cout << placement[i] << " ";

    return 0;
}

vector<ll>::iterator findNum(ll num)
{
    vector<ll>::iterator resIt = lower_bound(nums.begin(), nums.end(), num);
    if(resIt == nums.end() || *resIt != num)
        return nums.end();
    return resIt;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <utility>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

ll numCount, a, b;

vector<pair<ll, ll> > nums;
vector<int> placement;

vector<pair<ll, ll> >::iterator findNum(ll num);

int main()
{
    cin >> numCount >> a >> b;
    nums = vector<pair<ll, ll> >(numCount);
    placement = vector<int>(numCount,
                            -1);
    for(ll i = 0; i < numCount; i++)
    {
        cin >> nums[i].first;
        nums[i].second = i;
    }

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

    for(ll linearIndex = 0; linearIndex < numCount; linearIndex++)
    {
        vector<pair<ll, ll> >::iterator firstIndex, secondIndex;
        // 0 --> inserting sequence to "a"
        // 1 --> inserting sequence to "b"
        int path;
        ll thisSetSum,
           otherSetSum;

        if((((firstIndex = findNum(a - nums[linearIndex].first)) != nums.end()) &
            ((secondIndex = findNum(b - nums[linearIndex].first)) != nums.end()) &
            (firstIndex != secondIndex)) ||
           (placement[firstIndex->second] != -1))
            continue;

        // Sequence is inserted to "a"
        if(secondIndex == nums.end())
        {
            path = 0;
            secondIndex = firstIndex;
            if(secondIndex == nums.end())
            {
                cout << "NO";
                return 0;
            }
        }
        // Sequence is inserted to "b"
        else
        {
            path = 1;
        }
        thisSetSum = ((path)? b : a);
        otherSetSum = ((path)? a : b);

        firstIndex = nums.begin() + linearIndex;

        do
        {
            placement[firstIndex->second] = placement[firstIndex->second] = path;

            firstIndex = findNum(otherSetSum - secondIndex->first);
            if(firstIndex == nums.end())
                break;
            secondIndex = findNum(thisSetSum - firstIndex->first);
            if(secondIndex == nums.end())
            {
                cout << "NO";
                return 0;
            }
        } while(true);

        /* DEBUG
        for(ll i = 0; i < numCount; i++)
            if(placement[i] == -1)
                cerr << "-1 ";
            else
                cerr << " " << placement[i] << " ";
        cerr << endl;
        //*/
    }

    cout << "YES\n";
    for(ll i = 0; i < numCount; i++)
        cout << placement[i] << " ";

    return 0;
}

vector<pair<ll, ll> >::iterator findNum(ll num)
{
    vector<pair<ll, ll> >::iterator resIt = lower_bound(nums.begin(), nums.end(), pair<ll, ll>(num, 0));
    if(resIt == nums.end() || (*resIt).first != num)
        return nums.end();
    return resIt;
}


#include <bits/stdc++.h>
#define MAX(a,b) a>b?a:b
#define MIN(a,b) a<b?a:b

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

vector < pair<int,int> > p,A,B;

bool cmp(pii a, pii b)
{
    return a.second<b.second;
}

int binSearch(int s,int e,int v)
{
    if(s > e)   return -1;
    int md = (s+e)/2;
    if(p[md].second == v)
        return md;
    else if(p[md].second < v)
        return binSearch(md+1,e,v);
    else
        return binSearch(s,md-1,v);
}
bool ndiv(vector<pii> &C, vector<pii> &D,int n,int a,int b)
{
    map<int,bool> visited;
    int i =0,x;
    C.push_back(p[i]);
    visited[p[i].second] = true;
    while(!visited[a- p[i].second])
    {
        visited[a- p[i].second] = true;
        x = binSearch(0,n-1,a-p[i].second);
        if(p[x].second != a-p[i].second)
        {
            return false;
        }
        else
        {
            C.push_back(p[x]);
            i = x;
        }
    }

    for(i = 0; i < n; i++)
    {
        if(!visited[p[i].second])
            break;
    }
    if(i == n)  return true;
    D.push_back(p[i]);
    visited[p[i].second] = true;
    while(!visited[b-p[i].second])
    {
        visited[b-p[i].second] = true;
        x = binSearch(0,n-1,b-p[i].second);
        if(p[x].second != b-p[i].second)
        {
            return false;
        }
        else
        {
            D.push_back(p[x]);
            i = x;
        }
    }

    for(i = 0; i < n; i++)
        if(!visited[p[i].second])
        {
            return false;
        }

    return true;

}

int main()
{
    int n,a,b;
    scanf("%d%d%d", &n, &a, &b);
    for(int i = 0; i < n; i++)
    {
        int j;
        scanf("%d", &j);
        p.push_back(make_pair(i,j));
    }
    sort(p.begin(),p.end(),cmp);

    bool valid = ndiv(A,B,n,a,b);
    if(!valid)
    {
        A.clear();
        B.clear();
        valid = ndiv(B,A,n,b,a);
    }

    if(valid)
    {
        cout<<"YES"<<endl;
        vector<int> ans(n,0);
        for(int i = 0; i < (int)B.size(); i++)
            ans[B[i].first] = 1;
        for(int i = 0; i < n; i++)
            cout<<ans[i]<<" ";
        cout<<endl;
    }
    else    cout<<"NO"<<endl;

    return 0;
}


#include <bits/stdc++.h>
#define MAX(a,b) a>b?a:b
#define MIN(a,b) a<b?a:b

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

vector < pair<int,int> > p,A,B;

bool cmp(pii a, pii b)
{
    return a.second<b.second;
}

int binSearch(int s,int e,int v)
{
    if(s > e)   return -1;
    int md = (s+e)/2;
    if(p[md].second == v)
        return md;
    else if(p[md].second < v)
        return binSearch(md+1,e,v);
    else
        return binSearch(s,md-1,v);
}
bool ndiv(vector<pii> &C, vector<pii> &D,int n,int a,int b)
{
    map<int,int> visited;
    int i =0,x;
    C.push_back(p[i]);
    visited[p[i].second] = 1;
    while(visited[a- p[i].second] == 0)
    {
        visited[a- p[i].second] = 1;

        x = binSearch(0,n-1,a-p[i].second);
        if(x == -1)
        {
            return false;
        }
        else
        {
            C.push_back(p[x]);
            i = x;
        }
    }

    for(i = 0; i < n; i++)
    {
        if(visited[p[i].second] == 0)
            break;
    }
    if(i == n)  return true;
    D.push_back(p[i]);
    visited[p[i].second] = 2;
    while(visited[b-p[i].second] == 0)
    {
        visited[b-p[i].second] = 2;

        x = binSearch(0,n-1,b-p[i].second);
        if(x == -1 || visited[p[x].second] == 1)
        {
            return false;
        }
        else
        {
            D.push_back(p[x]);
            i = x;
        }
    }

    for(i = 0; i < n; i++)
        if(visited[p[i].second] == 0)
        {
            return false;
        }

    return true;

}

int main()
{
    int n,a,b;
    scanf("%d%d%d", &n, &a, &b);
    for(int i = 0; i < n; i++)
    {
        int j;
        scanf("%d", &j);
        p.push_back(make_pair(i,j));
    }
    sort(p.begin(),p.end(),cmp);

    bool valid = ndiv(A,B,n,a,b);
    if(!valid)
    {
        A.clear();
        B.clear();
        valid = ndiv(B,A,n,b,a);
    }

    if(valid)
    {
        cout<<"YES"<<endl;
        vector<int> ans(n,0);
        for(int i = 0; i < (int)B.size(); i++)
            ans[B[i].first] = 1;
        for(int i = 0; i < n; i++)
            cout<<ans[i]<<" ";
        cout<<endl;
    }
    else    cout<<"NO"<<endl;

    return 0;
}


#include <bits/stdc++.h>
#define MAX(a,b) a>b?a:b
#define MIN(a,b) a<b?a:b

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

vector < pair<int,int> > p,A,B;

bool cmp(pii a, pii b)
{
    return a.second<b.second;
}

int binSearch(int s,int e,int v)
{
    if(s > e)   return -1;
    int md = (s+e)/2;
    if(p[md].second == v)
        return md;
    else if(p[md].second < v)
        return binSearch(md+1,e,v);
    else
        return binSearch(s,md-1,v);
}
bool ndiv(vector<pii> &C, vector<pii> &D,int n,int a,int b)
{
    map<int,int> visited;
    int i =0,x;
    C.push_back(p[i]);
    visited[p[i].second] = 1;
    while(visited[a- p[i].second] == 0)
    {
        visited[a- p[i].second] = 1;
        x = binSearch(0,n-1,a-p[i].second);
        if(x == -1)
        {
            return false;
        }
        else
        {
            C.push_back(p[x]);
            i = x;
        }
    }

    for(i = 0; i < n; i++)
    {
        if(!visited[p[i].second])
            break;
    }
    if(i == n)  return true;
    D.push_back(p[i]);
    visited[p[i].second] = 2;
    while(visited[b-p[i].second] == 0)
    {
        visited[b-p[i].second] = 2;
        x = binSearch(0,n-1,b-p[i].second);
        if(x == -1 || visited[b-p[i].second] == 1)
        {
            return false;
        }
        else
        {
            D.push_back(p[x]);
            i = x;
        }
    }

    for(i = 0; i < n; i++)
        if(visited[p[i].second] == 0)
        {
            return false;
        }

    return true;

}

int main()
{
    int n,a,b;
    scanf("%d%d%d", &n, &a, &b);
    for(int i = 0; i < n; i++)
    {
        int j;
        scanf("%d", &j);
        p.push_back(make_pair(i,j));
    }
    sort(p.begin(),p.end(),cmp);

    bool valid = ndiv(A,B,n,a,b);
    if(!valid)
    {
        A.clear();
        B.clear();
        valid = ndiv(B,A,n,b,a);
    }

    if(valid)
    {
        cout<<"YES"<<endl;
        vector<int> ans(n,0);
        for(int i = 0; i < (int)B.size(); i++)
            ans[B[i].first] = 1;
        for(int i = 0; i < n; i++)
            cout<<ans[i]<<" ";
        cout<<endl;
    }
    else    cout<<"NO"<<endl;

    return 0;
}


#include <bits/stdc++.h>
#define MAX(a,b) a>b?a:b
#define MIN(a,b) a<b?a:b

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

vector < pair<int,int> > p,A,B;

bool cmp(pii a, pii b)
{
    return a.second<b.second;
}

int binSearch(int s,int e,int v)
{
    if(s > e)   return -1;
    int md = (s+e)/2;
    if(p[md].second == v)
        return md;
    else if(p[md].second < v)
        return binSearch(md+1,e,v);
    else
        return binSearch(s,md-1,v);
}
bool ndiv(vector<pii> &C, vector<pii> &D,int n,int a,int b)
{
    vector<int> visited(n,0);

    int i =0,x;
    C.push_back(p[i]);
    visited[i] = 1;
    x = binSearch(0,n-1,a-p[i].second);

    if(x == -1) return false;
    if(n == 919)    cout<<"1"<<endl;
    while(visited[x] != 1)
    {
        visited[x] = 1;
        C.push_back(p[x]);
        x = binSearch(0,n-1,a-p[x].second);
        if(x == -1) return false;
    }
     if(n == 919)    cout<<"2"<<endl;

    for(i = 0; i < n; i++)
    {
        if(visited[i] == 0)
            break;
    }
    if(i == n)  return true;
    D.push_back(p[i]);
    visited[i] = 2;
    x = binSearch(0,n-1,b-p[i].second);
    if(n == 919)    cout<<"x = "<<b-p[i].second<<endl;
    if(x == -1 || visited[x] == 1)
            return false;
     if(n == 919)    cout<<"3"<<endl;
    while(visited[x] == 0)
    {
        visited[x] = 2;
        D.push_back(p[x]);
        x = binSearch(0,n-1,b-p[x].second);
        if(x == -1 || visited[x] == 1)
            return false;
    }
     if(n == 919)    cout<<"4"<<endl;
    //cout<<(int)(C.size() + D.size())<<endl;

    return (int)(C.size() + D.size()) == n;

}

int main()
{
    int n,a,b;
    scanf("%d%d%d", &n, &a, &b);
    for(int i = 0; i < n; i++)
    {
        int j;
        scanf("%d", &j);
        p.push_back(make_pair(i,j));
    }
    sort(p.begin(),p.end(),cmp);

    bool valid = ndiv(A,B,n,a,b);
    if(!valid)
    {
         if(n == 919)    cout<<endl;
        A.clear();
        B.clear();
        valid = ndiv(B,A,n,b,a);
    }

    if(valid)
    {
        cout<<"YES"<<endl;
        vector<int> ans(n,0);
        for(int i = 0; i < (int)B.size(); i++)
            ans[B[i].first] = 1;
        for(int i = 0; i < n; i++)
            cout<<ans[i]<<" ";
        cout<<endl;
    }
    else    cout<<"NO"<<endl;

    return 0;
}


#include <bits/stdc++.h>
#define MAX(a,b) a>b?a:b
#define MIN(a,b) a<b?a:b

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

vector < pair<int,int> > p,A,B;

bool cmp(pii a, pii b)
{
    return a.second<b.second;
}

int binSearch(int s,int e,int v)
{
    if(s > e)   return -1;
    int md = (s+e)/2;
    if(p[md].second == v)
        return md;
    else if(p[md].second < v)
        return binSearch(md+1,e,v);
    else
        return binSearch(s,md-1,v);
}

bool ndiv(vector<pii> &C, vector<pii> &D,int n,int a,int b)
{
    vector<int> visited(n,0);

    for(int x = 0; x < n; x++)
    {
        int y;
        if(!visited[x])
        {
            y = binSearch(0,n-1,a-p[x].second);
            if(y != -1 && !visited[y])
            {
                C.push_back(p[x]);
                C.push_back(p[y]);
                visited[y] = 1;
            }
            else
            {
                y = binSearch(0,n-1,b-p[x].second);
                if(y != -1 && !visited[y])
                {
                    D.push_back(p[x]);
                    D.push_back(p[y]);
                    visited[y] = 1;
                }
                else    return false;
            }

        }

    }
    return true;

}

int main()
{
    int n,a,b;
    scanf("%d%d%d", &n, &a, &b);
    for(int i = 0; i < n; i++)
    {
        int j;
        scanf("%d", &j);
        p.push_back(make_pair(i,j));
    }
    sort(p.begin(),p.end(),cmp);

    bool valid = ndiv(A,B,n,a,b);
    if(!valid)
    {
         //if(n == 919)    cout<<endl;
        A.clear();
        B.clear();
        valid = ndiv(B,A,n,b,a);
    }

    if(valid)
    {
        cout<<"YES"<<endl;
        vector<int> ans(n,0);
        for(int i = 0; i < (int)B.size(); i++)
            ans[B[i].first] = 1;
        for(int i = 0; i < n; i++)
            cout<<ans[i]<<" ";
        cout<<endl;
    }
    else    cout<<"NO"<<endl;

    return 0;
}


#include <bits/stdc++.h>
#define MAX(a,b) a>b?a:b
#define MIN(a,b) a<b?a:b

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

vector < pair<int,int> > p,A,B;

bool cmp(pii a, pii b)
{
    return a.second<b.second;
}

int binSearch(int s,int e,int v)
{
    if(s > e)   return -1;
    int md = (s+e)/2;
    if(p[md].second == v)
        return md;
    else if(p[md].second < v)
        return binSearch(md+1,e,v);
    else
        return binSearch(s,md-1,v);
}

bool ndiv(vector<pii> &C, vector<pii> &D,int n,int a,int b)
{
    vector<int> visited(n,0);

    for(int x = 0; x < n; x++)
    {
        int y;
        if(!visited[x])
        {
            y = binSearch(0,n-1,a-p[x].second);
            if(y != -1)
            {
                C.push_back(p[x]);
                C.push_back(p[y]);
                visited[y] = 1;
            }
            else
            {
                y = binSearch(0,n-1,b-p[x].second);
                if(y != -1)
                {
                    D.push_back(p[x]);
                    D.push_back(p[y]);
                    visited[y] = 1;
                }
                else    return false;
            }

        }

    }
    return true;

}

int main()
{
    int n,a,b;
    scanf("%d%d%d", &n, &a, &b);
    for(int i = 0; i < n; i++)
    {
        int j;
        scanf("%d", &j);
        p.push_back(make_pair(i,j));
    }
    sort(p.begin(),p.end(),cmp);

    bool valid = ndiv(A,B,n,a,b);
    if(!valid)
    {
         if(n == 919)    cout<<endl;
        A.clear();
        B.clear();
        valid = ndiv(B,A,n,b,a);
    }

    if(valid)
    {
        cout<<"YES"<<endl;
        vector<int> ans(n,0);
        for(int i = 0; i < (int)B.size(); i++)
            ans[B[i].first] = 1;
        for(int i = 0; i < n; i++)
            cout<<ans[i]<<" ";
        cout<<endl;
    }
    else    cout<<"NO"<<endl;

    return 0;
}


#include <bits/stdc++.h>
#define MAX(a,b) a>b?a:b
#define MIN(a,b) a<b?a:b

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

vector < pair<int,int> > p,A,B;

bool cmp(pii a, pii b)
{
    return a.second<b.second;
}

int binSearch(int s,int e,int v)
{
    if(s > e)   return -1;
    int md = (s+e)/2;
    if(p[md].second == v)
        return md;
    else if(p[md].second < v)
        return binSearch(md+1,e,v);
    else
        return binSearch(s,md-1,v);
}
bool ndiv(vector<pii> &C, vector<pii> &D,int n,int a,int b)
{
    vector<int> visited(n,0);

    int i =0,x;
    C.push_back(p[i]);
    visited[i] = 1;
    x = binSearch(0,n-1,a-p[i].second);
    if(x == -1) return false;
    while(visited[x] != 1)
    {
        visited[x] = 1;
        C.push_back(p[x]);
        x = binSearch(0,n-1,a-p[x].second);
        if(x == -1) return false;
    }

    for(i = 0; i < n; i++)
    {
        if(visited[i] == 0)
            break;
    }
    if(i == n)  return true;
    D.push_back(p[i]);
    visited[i] = 2;
    x = binSearch(0,n-1,b-p[i].second);
    if(x == -1 || visited[x] == 1)
            return false;
    while(visited[x] == 0)
    {
        visited[x] = 2;
        D.push_back(p[x]);
        x = binSearch(0,n-1,b-p[x].second);
        if(x == -1 || visited[x] == 1)
            return false;
    }
    //cout<<(int)(C.size() + D.size())<<endl;

    return (int)(C.size() + D.size()) == n;

}

int main()
{
    int n,a,b;
    scanf("%d%d%d", &n, &a, &b);
    for(int i = 0; i < n; i++)
    {
        int j;
        scanf("%d", &j);
        p.push_back(make_pair(i,j));
    }
    sort(p.begin(),p.end(),cmp);

    bool valid = ndiv(A,B,n,a,b);
    if(!valid)
    {
        A.clear();
        B.clear();
        valid = ndiv(B,A,n,b,a);
    }

    if(valid)
    {
        cout<<"YES"<<endl;
        vector<int> ans(n,0);
        for(int i = 0; i < (int)B.size(); i++)
            ans[B[i].first] = 1;
        for(int i = 0; i < n; i++)
            cout<<ans[i]<<" ";
        cout<<endl;
    }
    else    cout<<"NO"<<endl;

    return 0;
}


#include <bits/stdc++.h>
#define MAX(a,b) a>b?a:b
#define MIN(a,b) a<b?a:b

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

vector < pair<int,int> > p,A,B;

bool cmp(pii a, pii b)
{
    return a.second<b.second;
}

int binSearch(int s,int e,int v)
{
    if(s > e)   return -1;
    int md = (s+e)/2;
    if(p[md].second == v)
        return md;
    else if(p[md].second < v)
        return binSearch(md+1,e,v);
    else
        return binSearch(s,md-1,v);
}
bool ndiv(vector<pii> &C, vector<pii> &D,int n,int a,int b)
{
    map<int,int> visited;
    int i =0,x;
    C.push_back(p[i]);
    visited[p[i].second] = 1;
    while(visited[a- p[i].second] != 1)
    {
        visited[a- p[i].second] = 1;

        x = binSearch(0,n-1,a-p[i].second);
        if(x == -1)
        {
            return false;
        }
        else
        {
            C.push_back(p[x]);
            i = x;
        }
    }

    for(i = 0; i < n; i++)
    {
        if(visited[p[i].second] == 0)
            break;
    }
    if(i == n)  return true;
    D.push_back(p[i]);
    visited[p[i].second] = 2;
    while(visited[b-p[i].second] != 2)
    {
        visited[b-p[i].second] = 2;

        x = binSearch(0,n-1,b-p[i].second);
        if(x == -1 || visited[p[x].second] == 1)
        {
            return false;
        }
        else
        {
            D.push_back(p[x]);
            i = x;
        }
    }

    for(i = 0; i < n; i++)
        if(visited[p[i].second] == 0)
        {
            return false;
        }

    return true;

}

int main()
{
    int n,a,b;
    scanf("%d%d%d", &n, &a, &b);
    for(int i = 0; i < n; i++)
    {
        int j;
        scanf("%d", &j);
        p.push_back(make_pair(i,j));
    }
    sort(p.begin(),p.end(),cmp);

    bool valid = ndiv(A,B,n,a,b);
    if(!valid)
    {
        A.clear();
        B.clear();
        valid = ndiv(B,A,n,b,a);
    }

    if(valid)
    {
        cout<<"YES"<<endl;
        vector<int> ans(n,0);
        for(int i = 0; i < (int)B.size(); i++)
            ans[B[i].first] = 1;
        for(int i = 0; i < n; i++)
            cout<<ans[i]<<" ";
        cout<<endl;
    }
    else    cout<<"NO"<<endl;

    return 0;
}


#include <bits/stdc++.h>
#define MAX(a,b) a>b?a:b
#define MIN(a,b) a<b?a:b

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

vector < pair<int,int> > p,A,B;

bool cmp(pii a, pii b)
{
    return a.second<b.second;
}

int binSearch(int s,int e,int v)
{
    if(s > e)   return -1;
    int md = (s+e)/2;
    if(p[md].second == v)
        return md;
    else if(p[md].second < v)
        return binSearch(md+1,e,v);
    else
        return binSearch(s,md-1,v);
}
bool ndiv(vector<pii> &C, vector<pii> &D,int n,int a,int b)
{
    map<int,int> visited;
    int i =0,x;
    C.push_back(p[i]);
    visited[p[i].second] = 1;
    while(visited[a- p[i].second] == 0)
    {
        visited[a- p[i].second] = 1;
        x = binSearch(0,n-1,a-p[i].second);
        if(x == -1)
        {
            return false;
        }
        else
        {
            C.push_back(p[x]);
            i = x;
        }
    }

    for(i = 0; i < n; i++)
    {
        if(!visited[p[i].second])
            break;
    }
    if(i == n)  return true;
    D.push_back(p[i]);
    visited[p[i].second] = 2;
    while(visited[b-p[i].second] == 0)
    {
        visited[b-p[i].second] = 2;
        x = binSearch(0,n-1,b-p[i].second);
        if(x == -1 || visited[x] == 1)
        {
            return false;
        }
        else
        {
            D.push_back(p[x]);
            i = x;
        }
    }

    for(i = 0; i < n; i++)
        if(visited[p[i].second] == 0)
        {
            return false;
        }

    return true;

}

int main()
{
    int n,a,b;
    scanf("%d%d%d", &n, &a, &b);
    for(int i = 0; i < n; i++)
    {
        int j;
        scanf("%d", &j);
        p.push_back(make_pair(i,j));
    }
    sort(p.begin(),p.end(),cmp);

    bool valid = ndiv(A,B,n,a,b);
    if(!valid)
    {
        A.clear();
        B.clear();
        valid = ndiv(B,A,n,b,a);
    }

    if(valid)
    {
        cout<<"YES"<<endl;
        vector<int> ans(n,0);
        for(int i = 0; i < (int)B.size(); i++)
            ans[B[i].first] = 1;
        for(int i = 0; i < n; i++)
            cout<<ans[i]<<" ";
        cout<<endl;
    }
    else    cout<<"NO"<<endl;

    return 0;
}


#include <bits/stdc++.h>
#define MAX(a,b) a>b?a:b
#define MIN(a,b) a<b?a:b

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

vector < pair<int,int> > p,A,B;

bool cmp(pii a, pii b)
{
    return a.second<b.second;
}

int binSearch(int s,int e,int v)
{
    if(s > e)   return -1;
    int md = (s+e)/2;
    if(p[md].second == v)
        return md;
    else if(p[md].second < v)
        return binSearch(md+1,e,v);
    else
        return binSearch(s,md-1,v);
}
bool ndiv(vector<pii> &C, vector<pii> &D,int n,int a,int b)
{
    vector<int> visited(n,0);

    int i =0,x;
    C.push_back(p[i]);
    visited[i] = 1;
    x = binSearch(0,n-1,a-p[i].second);

    if(x == -1) return false;
    if(n == 919)    cout<<"1"<<endl;
    while(visited[x] != 1)
    {
        visited[x] = 1;
        C.push_back(p[x]);
        x = binSearch(0,n-1,a-p[x].second);
        if(x == -1) return false;
    }
     if(n == 919)    cout<<"2"<<endl;

    for(i = 0; i < n; i++)
    {
        if(visited[i] == 0)
            break;
    }
    if(i == n)  return true;
    D.push_back(p[i]);
    visited[i] = 2;
    x = binSearch(0,n-1,b-p[i].second);
    if(n == 919)    cout<<"x = "<<x<<endl;
    if(x == -1 || visited[x] == 1)
            return false;
     if(n == 919)    cout<<"3"<<endl;
    while(visited[x] == 0)
    {
        visited[x] = 2;
        D.push_back(p[x]);
        x = binSearch(0,n-1,b-p[x].second);
        if(x == -1 || visited[x] == 1)
            return false;
    }
     if(n == 919)    cout<<"4"<<endl;
    //cout<<(int)(C.size() + D.size())<<endl;

    return (int)(C.size() + D.size()) == n;

}

int main()
{
    int n,a,b;
    scanf("%d%d%d", &n, &a, &b);
    for(int i = 0; i < n; i++)
    {
        int j;
        scanf("%d", &j);
        p.push_back(make_pair(i,j));
    }
    sort(p.begin(),p.end(),cmp);

    bool valid = ndiv(A,B,n,a,b);
    if(!valid)
    {
         if(n == 919)    cout<<endl;
        A.clear();
        B.clear();
        valid = ndiv(B,A,n,b,a);
    }

    if(valid)
    {
        cout<<"YES"<<endl;
        vector<int> ans(n,0);
        for(int i = 0; i < (int)B.size(); i++)
            ans[B[i].first] = 1;
        for(int i = 0; i < n; i++)
            cout<<ans[i]<<" ";
        cout<<endl;
    }
    else    cout<<"NO"<<endl;

    return 0;
}


#include <bits/stdc++.h>
#define MAX(a,b) a>b?a:b
#define MIN(a,b) a<b?a:b

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

vector < pair<int,int> > p,A,B;

bool cmp(pii a, pii b)
{
    return a.second<b.second;
}

int binSearch(int s,int e,int v)
{
    if(s > e)   return -1;
    int md = (s+e)/2;
    if(p[md].second == v)
        return md;
    else if(p[md].second < v)
        return binSearch(md+1,e,v);
    else
        return binSearch(s,md-1,v);
}

bool ndiv(vector<pii> &C, vector<pii> &D,int n,int a,int b)
{
    vector<int> visited(n,0);

    for(int x = 0; x < n; x++)
    {
        int y;
        if(!visited[x])
        {
            y = binSearch(0,n-1,a-p[x].second);
            if(y != -1 && !visited[y])
            {
                C.push_back(p[x]);
                C.push_back(p[y]);
                visited[x] = 1;
                visited[y] = 1;
            }
            else
            {
                y = binSearch(0,n-1,b-p[x].second);
                if(y != -1 && !visited[y])
                {
                    D.push_back(p[x]);
                    D.push_back(p[y]);
                    visited[x] = 1;
                    visited[y] = 1;
                }
                else    return false;
            }

        }

    }
    return true;

}

int main()
{
    int n,a,b;
    scanf("%d%d%d", &n, &a, &b);
    for(int i = 0; i < n; i++)
    {
        int j;
        scanf("%d", &j);
        p.push_back(make_pair(i,j));
    }
    sort(p.begin(),p.end(),cmp);

    bool valid = ndiv(A,B,n,a,b);
    if(!valid)
    {
         //if(n == 919)    cout<<endl;
        A.clear();
        B.clear();
        valid = ndiv(B,A,n,b,a);
    }

    if(valid)
    {
        cout<<"YES"<<endl;
        vector<int> ans(n,0);
        for(int i = 0; i < (int)B.size(); i++)
            ans[B[i].first] = 1;
        for(int i = 0; i < n; i++)
            cout<<ans[i]<<" ";
        cout<<endl;
    }
    else    cout<<"NO"<<endl;

    return 0;
}


#include <bits/stdc++.h>
#define MAX(a,b) a>b?a:b
#define MIN(a,b) a<b?a:b

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

vector < pair<int,int> > p,A,B;

bool cmp(pii a, pii b)
{
    return a.second<b.second;
}

int binSearch(int s,int e,int v)
{
    if(s > e)   return -1;
    int md = (s+e)/2;
    if(p[md].second == v)
        return md;
    else if(p[md].second < v)
        return binSearch(md+1,e,v);
    else
        return binSearch(s,md-1,v);
}
bool ndiv(vector<pii> &C, vector<pii> &D,int n,int a,int b)
{
    map<int,int> visited;
    int i =0,x;
    C.push_back(p[i]);
    visited[p[i].second] = 1;
    while(visited[a- p[i].second] == 0)
    {
        visited[a- p[i].second] = 1;
        x = binSearch(0,n-1,a-p[i].second);
        if(x == -1)
        {
            return false;
        }
        else
        {
            C.push_back(p[x]);
            i = x;
        }
    }

    for(i = 0; i < n; i++)
    {
        if(!visited[p[i].second])
            break;
    }
    if(i == n)  return true;
    D.push_back(p[i]);
    visited[p[i].second] = 2;
    while(visited[b-p[i].second] == 0)
    {
        visited[b-p[i].second] = 2;
        x = binSearch(0,n-1,b-p[i].second);
        if(x == -1 || visited[p[i].second] == 1)
        {
            return false;
        }
        else
        {
            D.push_back(p[x]);
            i = x;
        }
    }

    for(i = 0; i < n; i++)
        if(visited[p[i].second] == 0)
        {
            return false;
        }

    return true;

}

int main()
{
    int n,a,b;
    scanf("%d%d%d", &n, &a, &b);
    for(int i = 0; i < n; i++)
    {
        int j;
        scanf("%d", &j);
        p.push_back(make_pair(i,j));
    }
    sort(p.begin(),p.end(),cmp);

    bool valid = ndiv(A,B,n,a,b);
    if(!valid)
    {
        A.clear();
        B.clear();
        valid = ndiv(B,A,n,b,a);
    }

    if(valid)
    {
        cout<<"YES"<<endl;
        vector<int> ans(n,0);
        for(int i = 0; i < (int)B.size(); i++)
            ans[B[i].first] = 1;
        for(int i = 0; i < n; i++)
            cout<<ans[i]<<" ";
        cout<<endl;
    }
    else    cout<<"NO"<<endl;

    return 0;
}


#include <bits/stdc++.h>
#define MAX(a,b) a>b?a:b
#define MIN(a,b) a<b?a:b

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

vector < pair<int,int> > p,A,B;

bool cmp(pii a, pii b)
{
    return a.second<b.second;
}

int binSearch(int s,int e,int v)
{
    if(s > e)   return -1;
    int md = (s+e)/2;
    if(p[md].second == v)
        return md;
    else if(p[md].second < v)
        return binSearch(md+1,e,v);
    else
        return binSearch(s,md-1,v);
}
bool ndiv(vector<pii> &C, vector<pii> &D,int n,int a,int b)
{
    vector<int> visited(n,0);

    int i =0,x;
    C.push_back(p[i]);
    visited[i] = 1;
    x = binSearch(0,n-1,a-p[i].second);

    if(x == -1) return false;
    if(n == 919)    cout<<"*"<<endl;
    while(visited[x] != 1)
    {
        visited[x] = 1;
        C.push_back(p[x]);
        x = binSearch(0,n-1,a-p[x].second);
        if(x == -1) return false;
    }
     if(n == 919)    cout<<"*"<<endl;

    for(i = 0; i < n; i++)
    {
        if(visited[i] == 0)
            break;
    }
    if(i == n)  return true;
    D.push_back(p[i]);
    visited[i] = 2;
    x = binSearch(0,n-1,b-p[i].second);
    if(x == -1 || visited[x] == 1)
            return false;
     if(n == 919)    cout<<"*"<<endl;
    while(visited[x] == 0)
    {
        visited[x] = 2;
        D.push_back(p[x]);
        x = binSearch(0,n-1,b-p[x].second);
        if(x == -1 || visited[x] == 1)
            return false;
    }
     if(n == 919)    cout<<"*"<<endl;
    //cout<<(int)(C.size() + D.size())<<endl;

    return (int)(C.size() + D.size()) == n;

}

int main()
{
    int n,a,b;
    scanf("%d%d%d", &n, &a, &b);
    for(int i = 0; i < n; i++)
    {
        int j;
        scanf("%d", &j);
        p.push_back(make_pair(i,j));
    }
    sort(p.begin(),p.end(),cmp);

    bool valid = ndiv(A,B,n,a,b);
    if(!valid)
    {
         if(n == 919)    cout<<endl;
        A.clear();
        B.clear();
        valid = ndiv(B,A,n,b,a);
    }

    if(valid)
    {
        cout<<"YES"<<endl;
        vector<int> ans(n,0);
        for(int i = 0; i < (int)B.size(); i++)
            ans[B[i].first] = 1;
        for(int i = 0; i < n; i++)
            cout<<ans[i]<<" ";
        cout<<endl;
    }
    else    cout<<"NO"<<endl;

    return 0;
}


#include <bits/stdc++.h>
#define MAX(a,b) a>b?a:b
#define MIN(a,b) a<b?a:b

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

vector < pair<int,int> > p,A,B;

bool cmp(pii a, pii b)
{
    return a.second<b.second;
}

int binSearch(int s,int e,int v)
{
    if(s > e)   return -1;
    int md = (s+e)/2;
    if(p[md].second == v)
        return md;
    else if(p[md].second < v)
        return binSearch(md+1,e,v);
    else
        return binSearch(s,md-1,v);
}
bool ndiv(vector<pii> &C, vector<pii> &D,int n,int a,int b)
{
    map<int,int> visited;
    int i =0,x;
    C.push_back(p[i]);
    visited[p[i].second] = 1;
    while(visited[a- p[i].second] != 1)
    {

        x = binSearch(0,n-1,a-p[i].second);
        if(x == -1)
        {
            return false;
        }
        else
        {
            visited[a- p[i].second] = 1;
            C.push_back(p[x]);
            i = x;
        }
    }

    for(i = 0; i < n; i++)
    {
        if(visited[p[i].second] == 0)
            break;
    }
    if(i == n)  return true;
    D.push_back(p[i]);
    visited[p[i].second] = 2;
    while(visited[b-p[i].second] != 2)
    {

        x = binSearch(0,n-1,b-p[i].second);
        if(x == -1 || visited[p[x].second] == 1)
        {
            return false;
        }
        else
        {
            visited[b-p[i].second] = 2;
            D.push_back(p[x]);
            i = x;
        }
    }

    for(i = 0; i < n; i++)
        if(visited[p[i].second] == 0)
        {
            return false;
        }

    return true;

}

int main()
{
    int n,a,b;
    scanf("%d%d%d", &n, &a, &b);
    for(int i = 0; i < n; i++)
    {
        int j;
        scanf("%d", &j);
        p.push_back(make_pair(i,j));
    }
    sort(p.begin(),p.end(),cmp);

    bool valid = ndiv(A,B,n,a,b);
    if(!valid)
    {
        A.clear();
        B.clear();
        valid = ndiv(B,A,n,b,a);
    }

    if(valid)
    {
        cout<<"YES"<<endl;
        vector<int> ans(n,0);
        for(int i = 0; i < (int)B.size(); i++)
            ans[B[i].first] = 1;
        for(int i = 0; i < n; i++)
            cout<<ans[i]<<" ";
        cout<<endl;
    }
    else    cout<<"NO"<<endl;

    return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <sstream>
#include <vector>
#include <list>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <utility>
#include <algorithm>
#include <limits>

#define INF 1000000000
#define Inf 1000000000000000000

using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vii> vvii;

int pa[100010],tCnt[100010],rk[100010],v[100010], g[100010];

void init(int n) {
  int i;
  for(i=0; i< n; i++) {
    pa[i] = i;
    tCnt[i] = 1;
    rk[i] = 0;
  }
}

int find(int x) {
  int a=x;
  while(pa[a]!=a) a=pa[a];
  int b=x,c;
  while(pa[b]!=a) {
    c=pa[b];
    pa[b]=a;
    b=c;
  }
  return(a);
}

void fUnion(int x, int y) {
  int px = find(x);
  int py = find(y);
  if (px == py) return;
  if (rk[px] > rk[py]) swap(px,py);
  if (rk[px] == rk[py]) rk[px]++;
  pa[py] = px;
  tCnt[px] += tCnt[py];
}

int main() {
    //freopen("in.txt","r",stdin);

    int n,a,b;
    bool resp = true;
    map<int,int> m;
    scanf("%d %d %d",&n,&a,&b);
    for(int i = 0; i < n; i++) {
            scanf("%d",&v[i]);
      }
      sort(v,v+n);
      for(int i = 0; i < n; i++)
            m[v[i]] = i;
    init(n);
    for(int i = 0; i < n; i++) {
      if (m.count(a - v[i]))
        fUnion(i,m[a-v[i]]);
      if (m.count(b - v[i]))
        fUnion(i,m[b-v[i]]);
    }
    for(int i = 0; i < n; i++) {
      if (!m.count(a - v[i]) && !m.count(b - v[i])) {
        printf("NO\n");
        return 0;
      }
    }
    for(int i = 0; i < n; i++) {
      if (m.count(a - v[i])) {
        g[find(i)] = 0;
      } else {
        g[find(i)] = 1;
      }
    }
    printf("YES\n%d",g[find(0)]);
    for(int i = 1; i < n; i++)
      printf(" %d",g[find(i)]);
    printf("\n");

    return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <sstream>
#include <vector>
#include <list>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <utility>
#include <algorithm>
#include <limits>

#define INF 1000000000
#define Inf 1000000000000000000

using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vii> vvii;

int pa[100010],tCnt[100010],rk[100010],v[100010], g[100010];

void init(int n) {
  int i;
  for(i=0; i< n; i++) {
    pa[i] = i;
    tCnt[i] = 1;
    rk[i] = 0;
  }
}

int find(int x) {
  int a=x;
  while(pa[a]!=a) a=pa[a];
  int b=x,c;
  while(pa[b]!=a) {
    c=pa[b];
    pa[b]=a;
    b=c;
  }
  return(a);
}

void fUnion(int x, int y) {
  int px = find(x);
  int py = find(y);
  if (px == py) return;
  if (rk[px] > rk[py]) swap(px,py);
  if (rk[px] == rk[py]) rk[px]++;
  pa[py] = px;
  tCnt[px] += tCnt[py];
}

int main() {
    //freopen("in.txt","r",stdin);

    int n,a,b;
    map<int,int> m;
    scanf("%d %d %d",&n,&a,&b);
    for(int i = 0; i < n; i++) {
            scanf("%d",&v[i]);
      }
      for(int i = 0; i < n; i++)
            m[v[i]] = i;
    init(n);
    for(int i = 0; i < n; i++) {
      if (m.count(a - v[i]))
        fUnion(i,m[a-v[i]]);
      if (m.count(b - v[i]))
        fUnion(i,m[b-v[i]]);
    }
    for(int i = 0; i < n; i++) {
      if (!m.count(a - v[i]) && !m.count(b - v[i])) {
        printf("NO\n");
        return 0;
      }
    }
    for(int i = 0; i < n; i++) {
      if (m.count(a - v[i]) && m.count(b - v[i]))
        continue;
      if (m.count(a - v[i])) {
        g[find(i)] = 0;
      } else {
        g[find(i)] = 1;
      }
    }
    printf("YES\n%d",g[find(0)]);
    for(int i = 1; i < n; i++)
      printf(" %d",g[find(i)]);
    printf("\n");

    return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <sstream>
#include <vector>
#include <list>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <utility>
#include <algorithm>
#include <limits>

#define INF 1000000000
#define Inf 1000000000000000000

using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vii> vvii;

int pa[100010],tCnt[100010],rk[100010],v[100010];

void init(int n) {
  int i;
  for(i=0; i< n; i++) {
    pa[i] = i;
    tCnt[i] = 1;
    rk[i] = 0;
  }
}

int find(int x) {
  int a=x;
  while(pa[a]!=a) a=pa[a];
  int b=x,c;
  while(pa[b]!=a) {
    c=pa[b];
    pa[b]=a;
    b=c;
  }
  return(a);
}

void fUnion(int x, int y) {
  int px = find(x);
  int py = find(y);
  if (px == py) return;
  if (rk[px] > rk[py]) swap(px,py);
  if (rk[px] == rk[py]) rk[px]++;
  pa[py] = px;
  tCnt[px] += tCnt[py];
}

int main() {
    //freopen("in.txt","r",stdin);

    int n,a,b;
    bool resp = true;
    map<int,int> m;
    scanf("%d %d %d",&n,&a,&b);
    for(int i = 0; i < n; i++) {
            scanf("%d",&v[i]);
      }
      sort(v,v+n);
      for(int i = 0; i < n; i++)
            m[v[i]] = i;
    init(n);
    for(int i = 0; i < n; i++) {
      if (m.count(a - v[i]))
        fUnion(i,m[a-v[i]]);
      if (m.count(b - v[i]))
        fUnion(i,m[b-v[i]]);
    }
    for(int i = 0; i < n; i++) {
      if (!m.count(a - v[i]) && !m.count(b - v[i])) {
        printf("NO\n");
        return 0;
      }
    }
    if (m.count(a - v[0])) {
      printf("YES\n%d",0);
      for(int i = 1; i < n; i++)
        printf(" %d",pa[i] == pa[0] ? 0 : 1);
      printf("\n");
    } else {
      printf("YES\n%d",1);
      for(int i = 1; i < n; i++)
        printf(" %d",pa[i] == pa[0] ? 1 : 0);
      printf("\n");
    }

    return 0;
}