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

int n, a, b;
int mrk[100010];
int id[100010];
int ac[7][2];

bool cmp(int x, int y){
	return mrk[x] < mrk[y];
}

int main(){
	scanf("%d", &n);
	scanf("%d%d", &a, &b);
	for(int i = 0; i < n; i++)
		scanf("%d", &mrk[i]);
	for(int i = 0; i < n; i++)
		id[i] = i;
	sort(id, id + n, cmp);
	int t1 = 1, t2 = 2;
	if(a < b) {swap(a, b); swap(t1, t2);}
	for(int i = 0; i < a; i++)
		ac[mrk[id[i]]][t1]++;
	for(int i = a; i < n; i++)
		ac[mrk[id[i]]][t2]++;
	for(int i = 0; i < n; i++){
		if(i) putchar(' ');
		if(ac[mrk[i]][1]){
			printf("1"); ac[mrk[i]][1]--;
		}
		else printf("2");
	}
	puts("");
	return 0;
}


#include<iostream>
#include<vector>
#include<string>
#include<stdlib.h>
#include<algorithm>

std::vector<int>scores;
/*
int main(){
	int max=-9000, xam;
	int n;
	int a[7];
	scanf("%d",&n);
	std::vector<std::string>names;
	for(int i=0;i<n;i++){
		std::string s;
		std::cin >> s >> a[0] >> a[1] >> a[2] >> a[3] >> a[4] >> a[5] >> a[6];
		names.push_back(s);
		scores.push_back(a[0]*100-a[1]*50+a[2]+a[3]+a[4]+a[5]+a[6]);
		if(max<scores[i]){
			max=scores[i];
			xam=i;
		}
	}
	std::cout << names[xam];
	//system("pause");
	return 0;
}
*/
using namespace std;
int main(){
	vector<int>scores2;
	int aces=0, deuces=0;
	int a, b, n, z;
	cin >> n >> a >> b;
	for(int i=0;i<n;i++){
		cin >> z;
		scores.push_back(z);
		scores2.push_back(z);
	}
	sort(scores.begin(),scores.end());
	//cout<<scores[a]<<' '<<scores[b]<<endl;
	for(int i=0;i<n;i++){
		if(a>b){
			if(scores2[i]>scores[a]){
				cout << 2 << ' ';
				deuces++;
			}else{
				if(aces<a){
					cout << 1 << ' ';
					aces++;
				}else{
					cout << 2 << ' ';
					deuces++;
				}
			}
		}else{
			if(scores2[i]>scores[b]){
				cout << 1 << ' ';
				aces++;
			}else{
				if(aces>=a){
					cout << 2 << ' ';
					deuces++;
				}else{
					cout << 1 << ' ';
					aces++;
				}
			}
		}
	}
	//system("PAUSE");
	return 0;
}


#include<iostream>
#include<vector>
#include<string>
#include<stdlib.h>
#include<algorithm>

std::vector<int>scores;
/*
int main(){
	int max=-9000, xam;
	int n;
	int a[7];
	scanf("%d",&n);
	std::vector<std::string>names;
	for(int i=0;i<n;i++){
		std::string s;
		std::cin >> s >> a[0] >> a[1] >> a[2] >> a[3] >> a[4] >> a[5] >> a[6];
		names.push_back(s);
		scores.push_back(a[0]*100-a[1]*50+a[2]+a[3]+a[4]+a[5]+a[6]);
		if(max<scores[i]){
			max=scores[i];
			xam=i;
		}
	}
	std::cout << names[xam];
	//system("pause");
	return 0;
}
*/
using namespace std;
int main(){
	vector<int>scores2;
	vector<int>scores3;
	int aces=0, deuces=0;
	int a, b, n, z;
	cin >> n >> a >> b;
	for(int i=0;i<n;i++){
		cin >> z;
		scores.push_back(z);
		scores2.push_back(z);
	}
	sort(scores.begin(),scores.end());
	//cout<<scores[a]<<' '<<scores[b]<<endl;
	for(int i=0;i<n;i++){
		if(a>b){
			if(scores2[i]>scores[a]){
				scores3.push_back(2);
			}else if(scores2[i]<scores[a]){
				scores3.push_back(1);
			}else{
				scores3.push_back(0);
			}
		}else{
			if(scores2[i]>scores[b]){
				scores3.push_back(1);
			}else if(scores2[i]<scores[b]){
				scores3.push_back(2);
			}else{
				scores3.push_back(0);
			}
		}
	}
	for(int i=0;i<n;i++){
		if(scores3[i]==0){
			if(aces<=a){
				cout << 1 << ' ';
				aces++;
			}else{
				cout << 2 << ' ';
				deuces++;
			}
		}else if(scores3[i]==1){
			cout << 1 << ' ';
			aces++;
		}else if(scores3[i]==2){
			cout << 2 << ' ';
			deuces++;
		}
	}
	//system("PAUSE");
	return 0;
}


#include<iostream>
#include<vector>
#include<string>
#include<stdlib.h>
#include<algorithm>

std::vector<int>scores;
/*
int main(){
	int max=-9000, xam;
	int n;
	int a[7];
	scanf("%d",&n);
	std::vector<std::string>names;
	for(int i=0;i<n;i++){
		std::string s;
		std::cin >> s >> a[0] >> a[1] >> a[2] >> a[3] >> a[4] >> a[5] >> a[6];
		names.push_back(s);
		scores.push_back(a[0]*100-a[1]*50+a[2]+a[3]+a[4]+a[5]+a[6]);
		if(max<scores[i]){
			max=scores[i];
			xam=i;
		}
	}
	std::cout << names[xam];
	//system("pause");
	return 0;
}
*/
using namespace std;
int main(){
	vector<int>scores2;
	vector<int>scores3;
	int aces=0, deuces=0;
	int a, b, n, z;
	cin >> n >> a >> b;
	for(int i=0;i<n;i++){
		cin >> z;
		scores.push_back(z);
		scores2.push_back(z);
	}
	sort(scores.begin(),scores.end());
	//cout<<scores[a]<<' '<<scores[b]<<endl;
	for(int i=0;i<n;i++){
		if(a>b){
			if(scores2[i]>scores[a]){
				scores3.push_back(2);
			}else if(scores2[i]<scores[a]){
				scores3.push_back(1);
			}else{
				scores3.push_back(0);
			}
		}else if(a<b){
			if(scores2[i]>scores[b]){
				scores3.push_back(1);
			}else if(scores2[i]<scores[b]){
				scores3.push_back(2);
			}else{
				scores3.push_back(0);
			}
		}else{
			scores3.push_back(0);
		}
	}
	for(int i=0;i<n;i++){
		if(scores3[i]==0){
			if(aces<a){
				cout << 1 << ' ';
				aces++;
			}else{
				cout << 2 << ' ';
				deuces++;
			}
		}else if(scores3[i]==1){
			cout << 1 << ' ';
			aces++;
		}else if(scores3[i]==2){
			cout << 2 << ' ';
			deuces++;
		}
	}
	//system("PAUSE");
	return 0;
}


#include<iostream>
#include<vector>
#include<string>
#include<stdlib.h>
#include<algorithm>

std::vector<int>scores;
/*
int main(){
	int max=-9000, xam;
	int n;
	int a[7];
	scanf("%d",&n);
	std::vector<std::string>names;
	for(int i=0;i<n;i++){
		std::string s;
		std::cin >> s >> a[0] >> a[1] >> a[2] >> a[3] >> a[4] >> a[5] >> a[6];
		names.push_back(s);
		scores.push_back(a[0]*100-a[1]*50+a[2]+a[3]+a[4]+a[5]+a[6]);
		if(max<scores[i]){
			max=scores[i];
			xam=i;
		}
	}
	std::cout << names[xam];
	//system("pause");
	return 0;
}
*/
using namespace std;
int main(){
	vector<int>scores2;
	int aces=0, deuces=0;
	int a, b, n, z;
	cin >> n >> a >> b;
	for(int i=0;i<n;i++){
		cin >> z;
		scores.push_back(z);
		scores2.push_back(z);
	}
	sort(scores.begin(),scores.end());
	for(int i=0;i<n;i++){
		if(scores2[i]>scores[a]&&a>n/2||scores2[i]<scores[a]&&a<n/2){
			cout << 2 << ' ';
			deuces++;
		}else{
			if(aces<a){
				cout << 1 << ' ';
				aces++;
			}else{
				cout << 2 << ' ';
				deuces++;
			}
		}
	}
	//system("PAUSE");
	return 0;
}


#include<iostream>
#include<vector>
#include<string>
#include<stdlib.h>
#include<algorithm>

std::vector<int>scores;
/*
int main(){
	int max=-9000, xam;
	int n;
	int a[7];
	scanf("%d",&n);
	std::vector<std::string>names;
	for(int i=0;i<n;i++){
		std::string s;
		std::cin >> s >> a[0] >> a[1] >> a[2] >> a[3] >> a[4] >> a[5] >> a[6];
		names.push_back(s);
		scores.push_back(a[0]*100-a[1]*50+a[2]+a[3]+a[4]+a[5]+a[6]);
		if(max<scores[i]){
			max=scores[i];
			xam=i;
		}
	}
	std::cout << names[xam];
	//system("pause");
	return 0;
}
*/
using namespace std;
int main(){
	vector<int>scores2;
	int aces=0, deuces=0;
	int a, b, n, z;
	cin >> n >> a >> b;
	for(int i=0;i<n;i++){
		cin >> z;
		scores.push_back(z);
		scores2.push_back(z);
	}
	sort(scores.begin(),scores.end());
	for(int i=0;i<n;i++){
		if(scores2[i]>scores[a]&&a>n/2||scores2[i]<scores[b]&&b>n/2){
			cout << 2 << ' ';
			deuces++;
		}else{
			if(aces<a){
				cout << 1 << ' ';
				aces++;
			}else{
				cout << 2 << ' ';
				deuces++;
			}
		}
	}
	//system("PAUSE");
	return 0;
}


#include<iostream>
#include<vector>
#include<string>
#include<stdlib.h>
#include<algorithm>

std::vector<int>scores;
/*
int main(){
	int max=-9000, xam;
	int n;
	int a[7];
	scanf("%d",&n);
	std::vector<std::string>names;
	for(int i=0;i<n;i++){
		std::string s;
		std::cin >> s >> a[0] >> a[1] >> a[2] >> a[3] >> a[4] >> a[5] >> a[6];
		names.push_back(s);
		scores.push_back(a[0]*100-a[1]*50+a[2]+a[3]+a[4]+a[5]+a[6]);
		if(max<scores[i]){
			max=scores[i];
			xam=i;
		}
	}
	std::cout << names[xam];
	//system("pause");
	return 0;
}
*/
using namespace std;
int main(){
	vector<int>scores2;
	vector<int>scores3;
	int aces=0, deuces=0;
	int a, b, n, z;
	cin >> n >> a >> b;
	for(int i=0;i<n;i++){
		cin >> z;
		scores.push_back(z);
		scores2.push_back(z);
	}
	sort(scores.begin(),scores.end());
	//cout<<scores[a]<<' '<<scores[b]<<endl;
	for(int i=0;i<n;i++){
		if(a>b){
			if(scores2[i]>scores[a]){
				scores3.push_back(2);
				deuces++;
			}else if(scores2[i]<scores[a]){
				scores3.push_back(1);
				aces++;
			}else{
				scores3.push_back(0);
			}
		}else if(a<b){
			if(scores2[i]>scores[b]){
				scores3.push_back(1);
				aces++;
			}else if(scores2[i]<scores[b]){
				scores3.push_back(2);
				deuces++;
			}else{
				scores3.push_back(0);
			}
		}else{
			scores3.push_back(0);
		}
	}
	for(int i=0;i<n;i++){
		if(scores3[i]==0){
			if(aces<a){
				cout << 1 << ' ';
				aces++;
			}else{
				cout << 2 << ' ';
				deuces++;
			}
		}else if(scores3[i]==1){
			cout << 1 << ' ';
		}else if(scores3[i]==2){
			cout << 2 << ' ';
		}
	}
	//system("PAUSE");
	return 0;
}


#include<iostream>
#include<vector>
#include<string>
#include<stdlib.h>
#include<algorithm>

std::vector<int>scores;
/*
int main(){
	int max=-9000, xam;
	int n;
	int a[7];
	scanf("%d",&n);
	std::vector<std::string>names;
	for(int i=0;i<n;i++){
		std::string s;
		std::cin >> s >> a[0] >> a[1] >> a[2] >> a[3] >> a[4] >> a[5] >> a[6];
		names.push_back(s);
		scores.push_back(a[0]*100-a[1]*50+a[2]+a[3]+a[4]+a[5]+a[6]);
		if(max<scores[i]){
			max=scores[i];
			xam=i;
		}
	}
	std::cout << names[xam];
	//system("pause");
	return 0;
}
*/
using namespace std;
int main(){
	vector<int>scores2;
	vector<int>scores3;
	int aces=0, deuces=0;
	int a, b, n, z;
	cin >> n >> a >> b;
	for(int i=0;i<n;i++){
		cin >> z;
		scores.push_back(z);
		scores2.push_back(z);
	}
	sort(scores.begin(),scores.end());
	//cout<<scores[a]<<' '<<scores[b]<<endl;
	for(int i=0;i<n;i++){
		if(a>b){
			if(scores2[i]>scores[a]){
				scores3.push_back(2);
			}else if(scores2[i]<scores[a]){
				scores3.push_back(1);
			}else{
				scores3.push_back(0);
			}
		}else{
			if(scores2[i]>scores[b]){
				scores3.push_back(1);
			}else if(scores2[i]<scores[b]){
				scores3.push_back(2);
			}else{
				scores3.push_back(0);
			}
		}
	}
	for(int i=0;i<n;i++){
		if(scores3[i]==0){
			if(aces<a){
				cout << 1 << ' ';
				aces++;
			}else{
				cout << 2 << ' ';
				deuces++;
			}
		}else if(scores3[i]==1){
			cout << 1 << ' ';
			aces++;
		}else if(scores3[i]==2){
			cout << 2 << ' ';
			deuces++;
		}
	}
	//system("PAUSE");
	return 0;
}


#include<iostream>
#include<vector>
#include<string>
#include<stdlib.h>
#include<algorithm>

std::vector<int>scores;
/*
int main(){
	int max=-9000, xam;
	int n;
	int a[7];
	scanf("%d",&n);
	std::vector<std::string>names;
	for(int i=0;i<n;i++){
		std::string s;
		std::cin >> s >> a[0] >> a[1] >> a[2] >> a[3] >> a[4] >> a[5] >> a[6];
		names.push_back(s);
		scores.push_back(a[0]*100-a[1]*50+a[2]+a[3]+a[4]+a[5]+a[6]);
		if(max<scores[i]){
			max=scores[i];
			xam=i;
		}
	}
	std::cout << names[xam];
	//system("pause");
	return 0;
}
*/
using namespace std;
int main(){
	vector<int>scores2;
	int aces=0, deuces=0;
	int a, b, n, z;
	cin >> n >> a >> b;
	for(int i=0;i<n;i++){
		cin >> z;
		scores.push_back(z);
		scores2.push_back(z);
	}
	sort(scores.begin(),scores.end());
	//cout<<scores[a]<<' '<<scores[b]<<endl;
	for(int i=0;i<n;i++){
		if(a>b){
			if(scores2[i]>scores[a]){
				cout << 2 << ' ';
				deuces++;
			}else{
				if(aces<a){
					cout << 1 << ' ';
					aces++;
				}else{
					cout << 2 << ' ';
					deuces++;
				}
			}
		}else{
			if(scores2[i]>scores[b]){
				cout << 1 << ' ';
				deuces++;
			}else{
				if(aces<b){
					cout << 2 << ' ';
					aces++;
				}else{
					cout << 1 << ' ';
					deuces++;
				}
			}
		}
	}
	//system("PAUSE");
	return 0;
}


#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <deque>
#include <string>
using namespace std;
#define MAX 300
char s[MAX]; int l, i, j, k, n; bool is, ln;
vector<string> x, o;
int main()
{
	gets(s); l=strlen(s); n--;
	for (i=0; i<l; i++)
	{
		for (j=i; s[j] && s[j]!=','; j++);
		x.push_back(""); n++;
		for (k=i; k<j; k++) x[n].push_back(s[k]);
		i=j;
	}
	if (s[l-1]==',') x.push_back(""), n++;
	n++;
	o.assign(x.size(), "");
	for (i=0; i<n; i++)
	{
		is=0; ln=0;
		for (j=0; j<x[i].size(); j++)
		{
			if (x[i][j]!=' ')
			{
				if (x[i][j]=='.')
				{
					if (is) o[i].push_back(' '); o[i].push_back('.'); o[i].push_back('.'); o[i].push_back('.');
					j+=2; ln=0;
				}
				else
				{
					if (ln) o[i].push_back(' ');
					while (j<x[i].size() && x[i][j]<='9' && x[i][j]>='0')
					{
						o[i].push_back(x[i][j]); j++;
					}
					j--;
					ln=1;
				}
				is=1;
			}
		}
	}
	printf("%s", o[0].c_str());
	for (int i=1; i<(n-1); i++) printf(", %s", o[i].c_str());
	if (n>1) { if (o[n-1].size()) printf(", %s", o[n-1].c_str()); else printf(","); }
	printf("\n");
	return 0;
}


#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <deque>
#include <string>
using namespace std;
#define MAX 100010
int n, a, b, x, f, s;
vector<pair<int, int> > v;
int r[MAX];
bool r1(pair<int, int> p, pair<int, int> q)
{
	if (p.first==q.first) return p.second>q.second; return p.first<q.first;
}
int main()
{
	scanf("%d %d %d", &n, &a, &b);
	for (int i=0; i<n; i++)
	{
		scanf("%d", &x); v.push_back(make_pair(x, i));
	}
	if (a==b)
	{
		printf("1"); for (int i=1; i<a; i++) printf(" 1");
		for (int i=0; i<a; i++) printf(" 2"); printf("\n"); return 0;
	}
	if (a>b)
	{
		sort(v.begin(), v.end());
		for (int i=0; i<a; i++)
			r[v[i].second]=1;
		for (int i=a; i<n; i++)
			r[v[i].second]=2;
	}
	else
	{
		sort(v.begin(), v.end(), r1);
		for (int i=0; i<b; i++)
			r[v[i].second]=2;
		for (int i=b; i<n; i++)
			r[v[i].second]=1;
	}
	printf("%d", r[0]);
	for (int i=1; i<n; i++) printf(" %d", r[i]); printf("\n");
	return 0;
}


#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <deque>
#include <string>
using namespace std;
#define MAX 100010
int n, a, b, x, f, s;
vector<pair<int, int> > v;
int r[MAX];
int main()
{
	scanf("%d %d %d", &n, &a, &b);
	for (int i=0; i<n; i++)
	{
		scanf("%d", &x); v.push_back(make_pair(x, i));
	}
	sort(v.begin(), v.end());
	if (a==b)
	{
		printf("1"); for (int i=1; i<a; i++) printf(" 1");
		for (int i=0; i<a; i++) printf(" 2"); printf("\n"); return 0;
	}
	if (a>b)
	{
		for (int i=0; i<a; i++)
			r[v[i].second]=1;
		for (int i=a; i<n; i++)
			r[v[i].second]=2;
	}
	else
	{
		for (int i=0; i<b; i++)
			r[v[i].second]=2;
		for (int i=b; i<n; i++)
			r[v[i].second]=1;
	}
	printf("%d", r[0]);
	for (int i=1; i<n; i++) printf(" %d", r[i]); printf("\n");
	return 0;
}


#include<iostream>
#include<string>
#include<cmath>
#include<algorithm>
#pragma comment(linker, "/STACK:167772160")
typedef long long int64;
using namespace std;
int n,i,j,a,b,x[100001],y[100001],v,k,uns[100001],p,q;
int findd(int l,int r,int xx)
{
	int t;
	t=(l+r)/2;
	if(l==r)
	{
		if(x[l]==xx)return l;else return -1;
	}else
	{
		if(x[t]>=xx)return findd(l,t,xx);else return findd(t+1,r,xx);
	}
}
int main()
{
	//freopen("input.txt","r",stdin);
	cin>>n;
	cin>>a>>b;

	if(a>b){p=1;q=2;}else {p=2;q=1;}

	for(i=0;i<n;i++){cin>>x[i];y[i]=x[i];}
	sort(x,x+n);

	if(a==b)
	{
		for(i=1;i<=a;i++)cout<<1<<" ";
		for(i=1;i<=b;i++)cout<<2<<" ";
		cout<<endl;
		return 0;
	}

	for(i=0;i<n;i++)uns[i]=q;

	k=0;
	v=max(a,b);

	if(p==1)
	{
	   for(i=0;i<n;i++)
	  {
		if(findd(0,v-1,y[i])!=-1 && k<v){uns[i]=p;k++;}
	  }
	}else
	{
		for(i=n-1;i>=0;i--)
	  {
		if(findd(0,v-1,y[i])!=-1 && k<v){uns[i]=p;k++;}
	  }
	}

	for(i=0;i<n;i++)cout<<uns[i]<<" ";

	return 0;
}


#include<iostream>
#include<string>
#include<cmath>
#include<algorithm>
#pragma comment(linker, "/STACK:167772160")
typedef long long int64;
using namespace std;
int n,i,j,a,b,x[100001],y[100001],v,k,uns[100001],p,q,w[6];
int findd(int l,int r,int xx)
{
	int t;
	t=(l+r)/2;
	if(l==r)
	{
		if(x[l]==xx)return l;else return -1;
	}else
	{
		if(x[t]>=xx)return findd(l,t,xx);else return findd(t+1,r,xx);
	}
}
int main()
{
	//freopen("input.txt","r",stdin);
	cin>>n;
	cin>>a>>b;

	if(a>b){p=1;q=2;}else {p=2;q=1;}

	for(i=0;i<n;i++){cin>>x[i];y[i]=x[i];}
	sort(x,x+n);

	if(a==b)
	{
		for(i=1;i<=a;i++)cout<<1<<" ";
		for(i=1;i<=b;i++)cout<<2<<" ";
		cout<<endl;
		return 0;
	}

	memset(w,0,sizeof(w));
	for(i=0;i<n;i++)uns[i]=q;

	k=0;
	v=max(a,b);

	for(i=0;i<v;i++)w[x[i]]++;

	if(p==1)
	{
	   for(i=0;i<n;i++)
	  {
		if(w[y[i]]){uns[i]=p;k++;w[y[i]]--;}
	  }
	}else
	{
		for(i=n-1;i>=0;i--)
	  {
		if(w[y[i]]){uns[i]=p;k++;w[y[i]]--;}
	  }
	}

	for(i=0;i<n;i++)cout<<uns[i]<<" ";

	return 0;
}


#include <stdio.h>
#include <algorithm>
#include <string>
#include <vector>

using namespace std;

const int MAXN = 100020;

int n, a, b;
int pt[MAXN];
int v[6], d[6];

int solve()
{
	scanf("%d", &n);
	scanf("%d%d", &a, &b);
	memset(v, 0, sizeof(v));
	memset(d, 0, sizeof(d));
	for (int i = 1; i <= n; i ++)
	{
		scanf("%d", &pt[i]);
		v[pt[i]] ++;
	}
	if (a == b)
	{
		printf("1");
		for (int i = 1; i < a; i ++)
			printf(" 1");
		for (int i = 0; i < b; i ++)
			printf(" 2");
		printf("\n");
		return 0;
	}
	int ea = a;
	if (a < b)
	{
		for (int i = 5; i; i --)
		{
			d[i] = min(v[i], ea);
			ea -= d[i];
		}
	}
	if (a > b)
	{
		for (int i = 1; i <= 5; i ++)
		{
			d[i] = min(v[i], ea);
			ea -= d[i];
		}
	}
	for (int i = 1; i <= n; i ++)
	{
		if (i > 1)  printf(" ");
		if (d[pt[i]] > 0)
		{
			printf("1");
			d[pt[i]] --;
		} else printf("2");
	}
	printf("\n");
	return 0;
}

int main()
{
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
	solve();
//	fclose(stdin);
//	fclose(stdout);
	return 0;
}


#include <stdio.h>
#include <algorithm>
#include <vector>
using namespace std;

typedef pair<int,int> pii;

int n, na, nb;
pii ar[200000];
int lab[200000];

bool cmpx(const pii& a, const pii& b)
{
	if (na == nb) return a.first < b.first;

	if (na > nb)
	{
		if (a.second != b.second) return a.second < b.second;
		return a.first < b.first;
	}
	else
	{
		if (a.second != b.second) return a.second > b.second;
		return a.first < b.first;
	}
}

int main()
{
	scanf("%d %d %d", &n, &na, &nb);

	int i;
	for (i=0; i<n; i++)
	{
		scanf("%d", &ar[i].second);
		ar[i].first = i;
	}

	sort(ar, ar+n, cmpx);
	for (i=0; i<na; i++) lab[ ar[i].first ] = 1;
	for (;i<n; i++) lab[ ar[i].first ] = 2;

	for (i=0; i<n; i++)
	{
		if (i) printf(" ");
		printf("%d", lab[i]);
	}
	printf("\n");
}


#define _CRT_SECURE_NO_DEPRECATE
#pragma comment(linker, "/STACK:16777216")
#ifndef ONLINE_JUDGE
#include <ctime>
#endif
#include <string>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <queue>
#include <iostream>
#include <sstream>
#include <stack>
#include <deque>
#include <cmath>
#include <memory.h>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <algorithm>
#include <utility>
using namespace std;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef long long ll;
typedef istringstream iss;
#define FOR(i,f,n) for(int i=f; i<n; ++i)
#define sz(a) ((int)a.size())
#define fill(w,v) memset(w,v,sizeof(w))
#define pb push_back
#define all(a) a.begin(),a.end()
#define mp make_pair
#define inf 1000000000
#define X first
#define Y second
template<class T> inline T gcd(T a, T b){T t; while (a && b) t = a, a = b%a, b = t; return a+b; }
template<class T> inline T power(T a, int p) {T r = T(1); while (p) { if (p&1) r = r*a; a = a*a; p >>= 1; } return r; }
template<class T> T extgcd(T a, T b, T& x, T& y) { if (b==0) return x=1, y=0, a; T x1, y1, g; g = extgcd(b, a%b, x1, y1); x = y1; y = x1 - a/b*y1; return g; }
template<class T> inline T Floor(T a, T b) { if (b<0) a=-a, b=-b; if (a<0) return (a-b+1)/b; return a/b; }
template<class T> inline T Ceil(T a, T b) { if (b<0) a=-a, b=-b; if (a<0) return a/b; return (a+b-1)/b; }

int N, M, K;

int nums[111111];
int main()
{
#ifndef ONLINE_JUDGE
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	clock_t startTime = clock();
#endif

	scanf("%d%d%d", &K, &N, &M);
	FOR(i,0,K)
	{
		int a;
		scanf("%d", &a);
		nums[i] = a;
	}

	vector<pair<int, pii> > arr;
	FOR(i,0,K){
		arr.push_back(mp(nums[i], mp(N <= M ? -i : i, 0)));
	}
	sort(arr.begin(), arr.end());

	int cntA = N;
	int cntB = M;

	int sum1 = 0;
	int sum2 = 0;
	int cnt1 = 0;
	int cnt2 = 0;

	for (int i=K-1; i>=0; --i) {
		if (N < M)
		{
			if (cntA > 0) {
				--cntA;
				arr[i].second.second = 1;
			} else {
				arr[i].second.second = 2;
			}
		}
		else if (N > M)
		{
			if (cntB > 0) {
				--cntB;
				arr[i].second.second = 2;
			} else {
				arr[i].second.second = 1;
			}
		}
		else // N == M
		{
			if (cnt1 < cnt2) {
				++cnt1;
				sum1 += arr[i].first;
				arr[i].second.second = 1;
			} else if (cnt2 < cnt1){
				++cnt2;
				sum2 += arr[i].first;
				arr[i].second.second = 2;
			} else {
				if (i > 0 && arr[i].first != arr[i-1].first && abs(arr[i].second.first) > abs(arr[i-1].second.first))
				{
					++cnt2;
					sum2 += arr[i].first;
					arr[i].second.second = 2;
				}
				else
				{
					++cnt1;
					sum1 += arr[i].first;
					arr[i].second.second = 1;
				}
			}
		}
	}

	pair<int, pii> res[111111];

	FOR(i,0,K) {
		res[abs(arr[i].second.first)] = arr[i];
	}
	FOR(i,0,K) {
		if (i != 0)
			printf(" ");
		printf("%d", res[i].second.second);
	}
	printf("\n");

#ifndef ONLINE_JUDGE
	clock_t endTime = clock();
	printf("\nTime: %.3lf\n", double(endTime-startTime)/CLOCKS_PER_SEC);
#endif
	return 0;
}


#define _CRT_SECURE_NO_DEPRECATE
#pragma comment(linker, "/STACK:16777216")
#ifndef ONLINE_JUDGE
#include <ctime>
#endif
#include <string>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <queue>
#include <iostream>
#include <sstream>
#include <stack>
#include <deque>
#include <cmath>
#include <memory.h>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <algorithm>
#include <utility>
using namespace std;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef long long ll;
typedef istringstream iss;
#define FOR(i,f,n) for(int i=f; i<n; ++i)
#define sz(a) ((int)a.size())
#define fill(w,v) memset(w,v,sizeof(w))
#define pb push_back
#define all(a) a.begin(),a.end()
#define mp make_pair
#define inf 1000000000
#define X first
#define Y second
template<class T> inline T gcd(T a, T b){T t; while (a && b) t = a, a = b%a, b = t; return a+b; }
template<class T> inline T power(T a, int p) {T r = T(1); while (p) { if (p&1) r = r*a; a = a*a; p >>= 1; } return r; }
template<class T> T extgcd(T a, T b, T& x, T& y) { if (b==0) return x=1, y=0, a; T x1, y1, g; g = extgcd(b, a%b, x1, y1); x = y1; y = x1 - a/b*y1; return g; }
template<class T> inline T Floor(T a, T b) { if (b<0) a=-a, b=-b; if (a<0) return (a-b+1)/b; return a/b; }
template<class T> inline T Ceil(T a, T b) { if (b<0) a=-a, b=-b; if (a<0) return a/b; return (a+b-1)/b; }

int N, M, K;

int nums[111111];
int main()
{
#ifndef ONLINE_JUDGE
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	clock_t startTime = clock();
#endif

	scanf("%d%d%d", &K, &N, &M);
	FOR(i,0,K)
	{
		int a;
		scanf("%d", &a);
		nums[i] = a;
	}

	if (N == M) {
		FOR(i,0,K) {
			if (i != 0)
				printf(" ");
			if (i < N)
				printf("1");
			else
				printf("2");
		}
		printf("\n");
		return 0;
	}

	vector<pair<int, pii> > arr;
	FOR(i,0,K){
		arr.push_back(mp(nums[i], mp(N <= M ? -i : i, 0)));
	}
	sort(arr.begin(), arr.end());

	int cntA = N;
	int cntB = M;

	int sum1 = 0;
	int sum2 = 0;
	int cnt1 = 0;
	int cnt2 = 0;

	for (int i=K-1; i>=0; --i) {
		if (N < M)
		{
			if (cntA > 0) {
				--cntA;
				arr[i].second.second = 1;
			} else {
				arr[i].second.second = 2;
			}
		}
		else if (N > M)
		{
			if (cntB > 0)
			{
				--cntB;
				arr[i].second.second = 2;
			}
			else
			{
				arr[i].second.second = 1;
			}
		}
		else // N == M
		{
			if (cnt1 < cnt2) {
				++cnt1;
				sum1 += arr[i].first;
				arr[i].second.second = 1;
			} else if (cnt2 < cnt1){
				++cnt2;
				sum2 += arr[i].first;
				arr[i].second.second = 2;
			}
		}
	}

	pair<int, pii> res[111111];

	FOR(i,0,K) {
		res[abs(arr[i].second.first)] = arr[i];
	}

	FOR(i,0,K) {
		if (i != 0)
			printf(" ");
		printf("%d", res[i].second.second);
	}
	printf("\n");

#ifndef ONLINE_JUDGE
	clock_t endTime = clock();
	printf("\nTime: %.3lf\n", double(endTime-startTime)/CLOCKS_PER_SEC);
#endif
	return 0;
}


#define _CRT_SECURE_NO_DEPRECATE
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <iostream>
#include <iterator>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <sstream>
#include <fstream>
#include <ctime>
#include <cstring>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
#define pb push_back
#define ppb pop_back
#define pi 3.1415926535897932384626433832795028841971
#define mp make_pair
#define x first
#define y second
#define sqr(a) (a)*(a)
#define D(a,b) sqrt(((a).x-(b).x)*((a).x-(b).x)+((a).y-(b).y)*((a).y-(b).y))
#define pii pair<int,int>
#define pdd pair<double,double>
#define INF 1000000000
#define FOR(i,a,b) for (int _n(b), i(a); i <= _n; i++)
#define FORD(i,a,b) for(int i=(a),_b=(b);i>=_b;i--)
#define all(c) (c).begin(), (c).end()
#define SORT(c) sort(all(c))
#define rep(i,n) FOR(i,1,(n))
#define rept(i,n) FOR(i,0,(n)-1)
#define L(s) (int)((s).size())
#define C(a) memset((a),0,sizeof(a))
#define VI vector <int>
#define ll long long

int a,b,c,d,i,j,n,m,k;
int mas[100001],sr[100001];
int cnt[6],fir[6];
VI ans(0);

inline void solve()
{
	VI cur(0);
	rept(i,n)
	{
		if (fir[mas[i]]>0)
		{
			--fir[mas[i]];
			cur.pb(1);
		} else
		cur.pb(2);
	}

	if (L(ans)==0) ans=cur; else
	if (cur<ans) ans=cur;
}
int main()
{
//	freopen("input.txt","r",stdin);
//	freopen("output.txt","w",stdout);

	scanf("%d",&n);
	scanf("%d%d",&a,&b);
	rept(i,n)
	{
		scanf("%d",&mas[i]);
		++cnt[mas[i]];
		sr[i]=mas[i];
	}

	if (a>b)
	{
		sort(sr,sr+n);
		rept(i,a) ++fir[sr[i]];
		solve();
	} else
	if (a<b)
	{
		sort(sr,sr+n); reverse(sr,sr+n);
		rept(i,a) ++fir[sr[i]];
		solve();
	} else
	{
		rept(i,a) ans.pb(1);
		rept(i,b) ans.pb(2);
	}

	rept(i,L(ans))
	{
		if (i) printf(" ");
		printf("%d",ans[i]);
	}
	printf("\n");
}


#define _CRT_SECURE_NO_DEPRECATE
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <iostream>
#include <iterator>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <sstream>
#include <fstream>
#include <ctime>
#include <cstring>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
#define pb push_back
#define ppb pop_back
#define pi 3.1415926535897932384626433832795028841971
#define mp make_pair
#define x first
#define y second
#define sqr(a) (a)*(a)
#define D(a,b) sqrt(((a).x-(b).x)*((a).x-(b).x)+((a).y-(b).y)*((a).y-(b).y))
#define pii pair<int,int>
#define pdd pair<double,double>
#define INF 1000000000
#define FOR(i,a,b) for (int _n(b), i(a); i <= _n; i++)
#define FORD(i,a,b) for(int i=(a),_b=(b);i>=_b;i--)
#define all(c) (c).begin(), (c).end()
#define SORT(c) sort(all(c))
#define rep(i,n) FOR(i,1,(n))
#define rept(i,n) FOR(i,0,(n)-1)
#define L(s) (int)((s).size())
#define C(a) memset((a),0,sizeof(a))
#define VI vector <int>
#define ll long long

int a,b,c,d,i,j,n,m,k;
char str[1001];
string s;
int main()
{
//	freopen("input.txt","r",stdin);
//	freopen("output.txt","w",stdout);

	gets(str);
	s=str;

	while (1)
	{
		bool ok=0;
		for (int i=0;i<L(s);++i)
		{
			if (s[i]==',')
			{
				a=i+1;
				while (a<L(s) && s[a]==' ') ++a;
				if (a>i+2)
				{
					ok=1;
					s.erase(i+1,a-i-2);
					break;
				} else
				if (i<L(s) && a==i+1)
				{
					ok=1;
					s.insert(i+1," ");
					break;
				}
			}
		}

		for (int i=1;i<L(s);++i)
		{
			if (s[i]!=',') continue;
			a=i-1;
			while (a>=0 && s[a]==' ') --a;
			if (a>=0 && s[a]==',') continue;
			if (a==i-1) continue;
			s.erase(a+1,i-a-1);
			ok=1;
			break;
		}

		for (int i=1;i<L(s)-2;)
		{
			if (s[i]=='.' && s[i+1]=='.' && s[i+2]=='.')
			{
				if (i+3<L(s) && s[i+3]==' ')
				{
					a=i+3;
					while (a<L(s) && s[a]==' ') ++a;
					if(a<L(s) && s[a]=='.') continue;
					s.erase(i+1,a-i-1);
					ok=1;
					break;
				}
				i+=3;
			} else ++i;
		}

		for (int i=1;i<L(s)-2;)
		{
			if (s[i]=='.' && s[i+1]=='.' && s[i+2]=='.')
			{
				a=i-1;
				while (a>=0 && s[a]==' ') --a;
				if (a==i-1)
				{
					ok=1;
					s.insert(i," ");
					++i;
				} else
				if (a<i-2)
				{
					ok=1;
					s.erase(a+1,i-a-2);
					break;
				}
				i+=3;
			} else ++i;
		}

		for (int i=0;i<L(s);++i)
		{
			if (s[i]>='0' && s[i]<='9'); else
			continue;

			a=i+1; c=0;
			while (a<L(s) && (s[a]<'0' || s[a]>'9'))
			{
					if (s[a]!=' ') ++c;
					++a;
			}
			if (a==L(s)) break;
			if (c) continue;

			if (a>i+2)
			{
				ok=1;
				s.erase(i+1,a-i-2);
				break;
			}
		}

		if (!ok) break;
	}

	cout<<s<<endl;
}


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

using namespace std;

struct nump
{
	int pos;
	int num;
	int flag;
};

bool cmp(nump a, nump b)
{
	if (a.num > b.num)
	{
		return 1;
	}
	else if (a.num == b.num)
	{
		if (a.pos > b.pos)
			return 1;
		else
		{
			return 0;
		}
	}
	else
	{
		return 0;
	}
}

int main()
{
	int n;
	int a, b;
	cin >> n >> a >> b;
	int *f = new int[n];
	nump np; np.flag = 0;
	vector<nump> _np;
	for (int i = 0; i < n; i++)
	{
		cin >> np.num;
		np.pos = i;
		_np.push_back(np);
	}
	sort(_np.begin(),_np.end(), cmp);
	/*for (int i = 0; i < _np.size(); i++)
	{
		printf("%d ", _np.at(i).num);
	}*/
	if (a > b)
	{
		for (int i = 0; i < b; i++)
		{
			f[_np.at(i).pos] = 2;
		}
		for (int i = b; i < n; i++)
		{
			f[_np.at(i).pos] = 1;
		}
	}
	else if (a < b)
	{
		for (int i = 0; i < a; i++)
		{
			f[_np.at(i).pos] = 2;
		}
		for (int i = a; i < n; i++)
		{
			f[_np.at(i).pos] = 1;
		}
	}
	else
	{
		for (int i = 0; i < a; i++)
		{
			f[i] = 1;
		}
		for (int i = a; i < a + b; i++)
		{
			f[i] = 2;
		}
	}
	for (int i = 0; i < n; i++)
	{
		printf("%d ",f[i]);
	}
	return 0;
}


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

using namespace std;

struct nump
{
	int pos;
	int num;
	int flag;
};

bool cmp(nump a, nump b)
{
	if (a.num > b.num)
	{
		return 1;
	}
	else if (a.num == b.num)
	{
		if (a.pos > b.pos)
			return 1;
		else
		{
			return 0;
		}
	}
	else
	{
		return 0;
	}
}

int main()
{
	int n;
	int a, b;
	cin >> n >> a >> b;
	int *f = new int[n];
	nump np; np.flag = 0;
	vector<nump> _np;
	for (int i = 0; i < n; i++)
	{
		cin >> np.num;
		np.pos = i;
		_np.push_back(np);
	}
	sort(_np.begin(),_np.end(), cmp);
	/*for (int i = 0; i < _np.size(); i++)
	{
		printf("%d ", _np.at(i).num);
	}*/
	if (a > b)
	{
		for (int i = 0; i < b; i++)
		{
			f[_np.at(i).pos] = 2;
		}
		for (int i = b; i < n; i++)
		{
			f[_np.at(i).pos] = 1;
		}
	}
	else if (a < b)
	{
		for (int i = 0; i < a; i++)
		{
			f[_np.at(i).pos] = 1;
		}
		for (int i = a; i < n; i++)
		{
			f[_np.at(i).pos] = 2;
		}
	}
	else
	{
		for (int i = 0; i < a; i++)
		{
			f[i] = 1;
		}
		for (int i = a; i < a + b; i++)
		{
			f[i] = 2;
		}
	}
	for (int i = 0; i < n; i++)
	{
		printf("%d ",f[i]);
	}
	return 0;
}


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

using namespace std;

struct nump
{
	int pos;
	int num;
	int flag;
};

bool cmp(nump a, nump b)
{
	if (a.num > b.num)
	{
		return 1;
	}
	else
	{
		return 0;
	}
}

int main()
{
	int n;
	int a, b;
	cin >> n >> a >> b;
	int *f = new int[n];
	nump np; np.flag = 0;
	vector<pair<int ,int> > _np(n);
	for (int i = 0; i < n; i++)
	{
		cin >>_np[i].first;
		_np[i].second = i;
		if (a<b)
		{
			_np[i].first *= -1;
		}
	}
	if (a != b)
	{
		sort(_np.begin(), _np.end());
	}
	for (int i = 0; i < a; i++)
	{
		f[_np.at(i).second] = 1;
	}
	for (int i = a; i < n; i++)
	{
		f[_np.at(i).second] = 2;
	}
	for (int i = 0; i < n; i++)
	{
		printf("%d ",f[i]);
	}
	return 0;
}


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

struct num
{
    int idx;
    int val;

    num(int _idx=0,int _val=0)
    {
        idx = _idx;
        val = _val;
    }
};

bool comp1(const num &n1,const num &n2)
{
    if(n1.val == n2.val)
    {
        return n1.idx < n2.idx;
    }
    return n1.val > n2.val;
}

bool comp2(const num &n1,const num &n2)
{
    if(n1.val == n2.val)
    {
        return n1.idx > n2.idx;
    }
    return n1.val > n2.val;
}

num g[100010];
int t[100010];

int main()
{
    int n;
    int a,b;
    cin >> n >> a >> b;
    for(int i=0;i<n;i++)
    {
        int temp;
        cin >> temp;
        g[i] = num(i,temp);
    }

    if(b < a)
    {
        sort(&g[0],&g[n],comp2);
        for(int i=n-1;i >= n-a;i--)
        {
            t[g[i].idx] = 1;
        }
        for(int i=n-a-1; i>=0 ; i--)
        {
            t[g[i].idx] = 2;
        }
        for(int i=0;i<n;i++)
        {
            cout << t[i] << " ";
        }
    }
    else if(b > a)
    {
        sort(&g[0],&g[n],comp1);
        for(int i=0;i<a;i++)
        {
            t[g[i].idx] = 1;
        }
        for(int i=a;i<n;i++)
        {
            t[g[i].idx] = 2;
        }
        for(int i=0;i<n;i++)
        {
            cout << t[i] << " ";
        }
    }
    else
    {
        for(int i=0;i<a;i++)
        {
            cout << 1 << " ";
        }
        for(int i=0;i<a;i++)
        {
            cout << 2 << " ";
        }
    }

    return 0;
}


#pragma warning(disable:4786)
#include<iostream>
#include<map>
#include<algorithm>
using namespace std;
int d[100005];
struct T
{
    int x,y;
}p[100005];
int f(T a,T b)
{
    return a.x!=b.x?a.x>b.x:a.y<b.y;
}
int main()
{
//  freopen("a.txt","r",stdin);
    int i,n,a,b,l1,l2;
    multimap<int,int> m;
    multimap<int,int>::reverse_iterator it;
    while(scanf("%d%d%d",&n,&a,&b)!=EOF)
    {
        for(i=0;i<n;i++)scanf("%d",&p[i].x),p[i].y=i;
        sort(p,p+n,f);
        l1=l2=0;
        for(i=0;i<n;i++)
        {
            if(l1==a)
            {
                d[p[i].y]=2;
                continue;
            }
            if(l2==b)
            {
                d[p[i].y]=1;
                continue;
            }
            if(a*p[i].x>b*p[i].x)d[p[i].y]=2,l2++;
            else d[p[i].y]=1,l1++;
        }
        for(i=0;i<n-1;i++)printf("%d ",d[i]);
        printf("%d\n",d[i]);
/*      m.clear();
        for(i=0;i<n;i++)
        {
            scanf("%d",&p);
            m.insert(pair<int,int>(p,i));
        }
        if(a==b)
        {
            for(i=0;i<n;i++)
            {
                if(i<n/2)printf("1");
                else printf("2");
                if(i!=n-1)printf(" ");
            }
            printf("\n");
            continue;
        }
        l1=l2=0;
        for(it=m.rbegin();it!=m.rend();it++)
        {
            if(l1==a)
            {
                d[(*it).second]=2;
                continue;
            }
            if(l2==b)
            {
                d[(*it).second]=1;
                continue;
            }
            if(b*((*it).first)<a*((*it).first))d[(*it).second]=2,l2++;
            else d[(*it).second]=1,l1++;
        }
        for(i=0;i<n-1;i++)printf("%d ",d[i]);
        printf("%d\n",d[n-1]);*/
    }
    return 0;
}


#include<iostream>
#include<algorithm>
using namespace std;
int d[100005];
struct T
{
    int x,y;
}p[100005];
int f(T a,T b)
{
    return a.x!=b.x?a.x>b.x:a.y<b.y;
}
int main()
{
//  freopen("a.txt","r",stdin);
    int i,j,n,a,b,l1,l2;
    while(scanf("%d%d%d",&n,&a,&b)!=EOF)
    {
        for(i=0;i<n;i++)scanf("%d",&p[i].x),p[i].y=i;
        if(a==b)
        {
            for(i=0;i<n;i++)
            {
                if(i<n/2)printf("1");
                else printf("2");
                if(i!=n-1)printf(" ");
            }
            printf("\n");
            continue;
        }
        sort(p,p+n,f);
        l1=l2=0;
        for(i=0;i<n;i++)
        {
            if(l1==a)
            {
                d[p[i].y]=2;
                continue;
            }
            if(l2==b)
            {
                d[p[i].y]=1;
                continue;
            }
            if(a*p[i].x>b*p[i].x)d[p[i].y]=2,l2++;
            else d[p[i].y]=1,l1++;
        }
        for(i=0;i<n-1;i++)
            if(p[i].x==p[i+1].x&&d[p[i].y]>d[p[i+1].y])
            {
                j=i+1;
                while(p[j-1].x==p[j].x&&d[p[j-1].y]>d[p[j].y])
                    swap(d[p[j-1].y],d[p[j].y]),j--;
            }
        for(i=0;i<n-1;i++)printf("%d ",d[i]);
        printf("%d\n",d[i]);
    }
    return 0;
}


#pragma warning(disable:4786)
#include<iostream>
#include<map>
#include<algorithm>
using namespace std;
int d[100005];
struct T
{
	int x,y;
}p[100005];
int f(T a,T b)
{
	return a.x!=b.x?a.x>b.x:a.y<b.y;
}
int main()
{
//	freopen("a.txt","r",stdin);
	int i,j,n,a,b,l1,l2;
	multimap<int,int> m;
	multimap<int,int>::reverse_iterator it;
	while(scanf("%d%d%d",&n,&a,&b)!=EOF)
	{
		for(i=0;i<n;i++)scanf("%d",&p[i].x),p[i].y=i;
		if(a==b)
		{
			for(i=0;i<n;i++)
			{
				if(i<n/2)printf("1");
				else printf("2");
				if(i!=n-1)printf(" ");
			}
			printf("\n");
			continue;
		}
		sort(p,p+n,f);
		l1=l2=0;
		for(i=0;i<n;i++)
		{
			if(l1==a)
			{
				d[p[i].y]=2;
				continue;
			}
			if(l2==b)
			{
				d[p[i].y]=1;
				continue;
			}
			if(a*p[i].x>b*p[i].x)d[p[i].y]=2,l2++;
			else d[p[i].y]=1,l1++;
		}//for(i=0;i<n;i++)printf("%d %d %d\n",p[i].x,p[i].y,d[p[i].y]);
		for(i=0;i<n-1;i++)
			if(p[i].x==p[i+1].x&&d[p[i].y]>d[p[i+1].y])
			{
				j=i+1;
				while(p[j-1].x==p[j].x&&d[p[j-1].y]>d[p[j].y])
					swap(d[p[j-1].y],d[p[j].y]),j--;
			}
		for(i=0;i<n-1;i++)printf("%d ",d[i]);
		printf("%d\n",d[i]);
/*		m.clear();
		for(i=0;i<n;i++)
		{
			scanf("%d",&p);
			m.insert(pair<int,int>(p,i));
		}
		if(a==b)
		{
			for(i=0;i<n;i++)
			{
				if(i<n/2)printf("1");
				else printf("2");
				if(i!=n-1)printf(" ");
			}
			printf("\n");
			continue;
		}
		l1=l2=0;
		for(it=m.rbegin();it!=m.rend();it++)
		{
			if(l1==a)
			{
				d[(*it).second]=2;
				continue;
			}
			if(l2==b)
			{
				d[(*it).second]=1;
				continue;
			}
			if(b*((*it).first)<a*((*it).first))d[(*it).second]=2,l2++;
			else d[(*it).second]=1,l1++;
		}
		for(i=0;i<n-1;i++)printf("%d ",d[i]);
		printf("%d\n",d[n-1]);*/
	}
	return 0;
}


#include<cstdio>
#include<algorithm>
using namespace std;
struct ponto
{
    int idx;
    int x;
    int q;
};
int a,b;
bool cmp(ponto aa, ponto bb)
{
    if(aa.x!=bb.x)
        return aa.x<bb.x;
    if(a>b)
        return aa.idx<bb.idx;
    else return aa.idx>bb.idx;
}
bool cmp2(ponto a, ponto b)
{
    return a.idx<b.idx;
}
int main()
{
    int n;
    ponto v[110000];
    scanf("%d",&n);
    scanf("%d %d",&a,&b);
    for(int i=0;i<n;i++)
    {
        scanf("%d",&v[i].x);
        v[i].idx=i;
    }
    if(a==b)
    {
        for(int i=0;i<a;i++)
            printf("1 ");
        for(int i=0;i<b-1;i++)
            printf("2 ");
        printf("2\n");
        return 0;
    }
    sort(v,v+n,cmp);
    int menor=1;
    if(b<a)
    {
        menor=2;
        swap(a,b);
    }
    for(int i=n-1;i>=n-a;i--)
        v[i].q = menor;
    for(int i=n-a-1;i>=0;i--)
        v[i].q = 3-menor;
    sort(v,v+n,cmp2);
    for(int i=0;i<n-1;i++)
        printf("%d ",v[i].q);
    printf("%d\n",v[n-1].q);
    return 0;
}


#pragma warning(disable:4786)
#include<iostream>
#include<map>
#include<algorithm>
using namespace std;
int d[100005];
struct T
{
    int x,y;
}p[100005];
int f(T a,T b)
{
    return a.x!=b.x?a.x>b.x:a.y<b.y;
}
int main()
{
//  freopen("a.txt","r",stdin);
    int i,j,n,a,b,l1,l2;
    multimap<int,int> m;
    multimap<int,int>::reverse_iterator it;
    while(scanf("%d%d%d",&n,&a,&b)!=EOF)
    {
        for(i=0;i<n;i++)scanf("%d",&p[i].x),p[i].y=i;
        if(a==b)
        {
            for(i=0;i<n;i++)
            {
                if(i<n/2)printf("1");
                else printf("2");
                if(i!=n-1)printf(" ");
            }
            printf("\n");
            continue;
        }
        sort(p,p+n,f);
        l1=l2=0;
        for(i=0;i<n;i++)
        {
            if(l1==a)
            {
                d[p[i].y]=2;
                continue;
            }
            if(l2==b)
            {
                d[p[i].y]=1;
                continue;
            }
            if(a*p[i].x>b*p[i].x)d[p[i].y]=2,l2++;
            else d[p[i].y]=1,l1++;
        }//for(i=0;i<n;i++)printf("%d %d %d\n",p[i].x,p[i].y,d[p[i].y]);
        for(i=0;i<n-1;i++)
            if(p[i].x==p[i+1].x&&d[p[i].y]>d[p[i+1].y])
                swap(d[p[i].y],d[p[i+1].y]);
        for(i=0;i<n-1;i++)printf("%d ",d[i]);
        printf("%d\n",d[i]);
/*      m.clear();
        for(i=0;i<n;i++)
        {
            scanf("%d",&p);
            m.insert(pair<int,int>(p,i));
        }
        if(a==b)
        {
            for(i=0;i<n;i++)
            {
                if(i<n/2)printf("1");
                else printf("2");
                if(i!=n-1)printf(" ");
            }
            printf("\n");
            continue;
        }
        l1=l2=0;
        for(it=m.rbegin();it!=m.rend();it++)
        {
            if(l1==a)
            {
                d[(*it).second]=2;
                continue;
            }
            if(l2==b)
            {
                d[(*it).second]=1;
                continue;
            }
            if(b*((*it).first)<a*((*it).first))d[(*it).second]=2,l2++;
            else d[(*it).second]=1,l1++;
        }
        for(i=0;i<n-1;i++)printf("%d ",d[i]);
        printf("%d\n",d[n-1]);*/
    }
    return 0;
}


#pragma warning(disable:4786)
#include<iostream>
#include<map>
#include<algorithm>
using namespace std;
int d[100005];
struct T
{
	int x,y;
}p[100005];
int f(T a,T b)
{
	return a.x!=b.x?a.x>b.x:a.y<b.y;
}
int main()
{
//	freopen("a.txt","r",stdin);
	int i,j,n,a,b,l1,l2;
	multimap<int,int> m;
	multimap<int,int>::reverse_iterator it;
	while(scanf("%d%d%d",&n,&a,&b)!=EOF)
	{
		for(i=0;i<n;i++)scanf("%d",&p[i].x),p[i].y=i;
		sort(p,p+n,f);
		l1=l2=0;
		for(i=0;i<n;i++)
		{
			if(l1==a)
			{
				d[p[i].y]=2;
				continue;
			}
			if(l2==b)
			{
				d[p[i].y]=1;
				continue;
			}
			if(a*p[i].x>b*p[i].x)d[p[i].y]=2,l2++;
			else d[p[i].y]=1,l1++;
		}//for(i=0;i<n;i++)printf("%d %d %d\n",p[i].x,p[i].y,d[p[i].y]);
		for(i=0;i<n-1;i++)
			if(p[i].x==p[i+1].x&&d[p[i].y]>d[p[i+1].y])
				swap(d[p[i].y],d[p[i+1].y]);
		for(i=0;i<n-1;i++)printf("%d ",d[i]);
		printf("%d\n",d[i]);
/*		m.clear();
		for(i=0;i<n;i++)
		{
			scanf("%d",&p);
			m.insert(pair<int,int>(p,i));
		}
		if(a==b)
		{
			for(i=0;i<n;i++)
			{
				if(i<n/2)printf("1");
				else printf("2");
				if(i!=n-1)printf(" ");
			}
			printf("\n");
			continue;
		}
		l1=l2=0;
		for(it=m.rbegin();it!=m.rend();it++)
		{
			if(l1==a)
			{
				d[(*it).second]=2;
				continue;
			}
			if(l2==b)
			{
				d[(*it).second]=1;
				continue;
			}
			if(b*((*it).first)<a*((*it).first))d[(*it).second]=2,l2++;
			else d[(*it).second]=1,l1++;
		}
		for(i=0;i<n-1;i++)printf("%d ",d[i]);
		printf("%d\n",d[n-1]);*/
	}
	return 0;
}


#pragma warning(disable:4786)
#include<iostream>
#include<map>
using namespace std;
int d[100005];
int main()
{
//  freopen("a.txt","r",stdin);
    int i,n,a,b,l1,l2,p;
    multimap<int,int> m;
    multimap<int,int>::reverse_iterator it;
    while(scanf("%d%d%d",&n,&a,&b)!=EOF)
    {
        m.clear();
        for(i=0;i<n;i++)
        {
            scanf("%d",&p);
            m.insert(pair<int,int>(p,i));
        }
        if(a==b)
        {
            for(i=0;i<n;i++)
            {
                if(i<n/2)printf("1");
                else printf("2");
                if(i!=n-1)printf(" ");
            }
            printf("\n");
            continue;
        }
        l1=l2=0;
        for(it=m.rbegin();it!=m.rend();it++)
        {
            if(l1==a)
            {
                d[(*it).second]=2;
                continue;
            }
            if(l2==b)
            {
                d[(*it).second]=1;
                continue;
            }
            if(b*((*it).first)<a*((*it).first))d[(*it).second]=2,l2++;
            else d[(*it).second]=1,l1++;
        }
        for(i=0;i<n-1;i++)printf("%d ",d[i]);
        printf("%d\n",d[n-1]);
    }
    return 0;
}


n=int(input())
a,b=map(int,input().split())
l=list(map(int,input().split()))

if a==b:
	print(*[1]*a+[2]*b)
else:
	h=[[l[i],i] for i in range(n)]
	h.sort(key=lambda x:x[0])
	ans=[0 for i in range(n)]
	if b<a:
		i=n-b
		j=n-b-1
		if h[i][0]==h[j][0]:
			while i<n and h[i][0]==h[n-b][0]:
				i+=1
			while j>-1 and h[j][0]==h[n-b-1][0]:
				j-=1
			i=i-1
			j=j+1
			na=n-b-j;nb=i-n+b+1
			k=h[j:i+1]
			k.sort(key=lambda x:x[1])
			for c in range(na):
				k[c][0]=1
			for c in range(na,na+nb):
				k[c][0]=2
			for c in range(na+nb):
				ans[k[c][1]]=k[c][0]
		for c in range(j+1):
			ans[h[c][1]]=1
		for c in range(i,n):
			ans[h[c][1]]=2
		print(*ans)
	else:
		i=n-a
		j=n-a-1
		if h[i][0]==h[j][0]:
			while i<n and h[i][0]==h[n-b][0]:
				i+=1
			while j>-1 and h[j][0]==h[n-b-1][0]:
				j-=1
			i=i-1
			j=j+1
			nb=n-a-j;na=i-n+a+1
			k=h[j:i+1]
			k.sort(key=lambda x:x[1])
			for c in range(na):
				k[c][0]=1
			for c in range(na,na+nb):
				k[c][0]=2
			for c in range(na+nb):
				ans[k[c][1]]=k[c][0]
		for c in range(j+1):
			ans[h[c][1]]=2
		for c in range(i,n):
			ans[h[c][1]]=1
		print(*ans)


n=int(input())
a,b=map(int,input().split())
l=list(map(int,input().split()))

if a==b:
	print(*[1]*a+[2]*b)
else:
	h=[[l[i],i] for i in range(n)]
	h.sort(key=lambda x:x[0])
	ans=[0 for i in range(n)]
	if b<a:
		i=n-b
		j=n-b-1
		if h[i][0]==h[j][0]:
			while i<n and h[i][0]==h[n-b][0]:
				i+=1
			while j>-1 and h[j][0]==h[n-b-1][0]:
				j-=1
			i=i-1
			j=j+1
			na=n-b-j;nb=i-n+b+1
			k=h[j:i+1]
			k.sort(key=lambda x:x[1])
			for c in range(na):
				k[c][0]=1
			for c in range(na,na+nb):
				k[c][0]=2
			for c in range(na+nb):
				ans[k[c][1]]=k[c][0]
		else:
			ans[h[j][1]]=1
			ans[h[i][1]]=2
		for c in range(j):
			ans[h[c][1]]=1
		for c in range(i+1,n):
			ans[h[c][1]]=2
		print(*ans)
	else:
		i=n-a
		j=n-a-1
		if h[i][0]==h[j][0]:
			while i<n and h[i][0]==h[n-a][0]:
				i+=1
			while j>-1 and h[j][0]==h[n-a-1][0]:
				j-=1
			i=i-1
			j=j+1
			nb=n-a-j;na=i-n+a+1
			k=h[j:i+1]
			k.sort(key=lambda x:x[1])
			for c in range(na):
				k[c][0]=1
			for c in range(na,na+nb):
				k[c][0]=2
			for c in range(na+nb):
				ans[k[c][1]]=k[c][0]
		else:
			ans[h[j][1]]=2
			ans[h[i][1]]=1
		for c in range(j):
			ans[h[c][1]]=2
		for c in range(i+1,n):
			ans[h[c][1]]=1
		print(*ans)


import sys
from math import *

def minp():
	return sys.stdin.readline().strip()

def mint():
	return int(minp())

def mints():
	return map(int, minp().split())

n = mint()
a, b = mints()
t = list(mints())
c = [0]*n
for i in range(n):
	c[i] = (t[i], -i if a<b else i)
c.sort(reverse=a<b)
f = [0]*n
for i in range(a):
	f[abs(c[i][1])] = 1
for i in range(a,a+b):
	f[abs(c[i][1])] = 2
print(*f)


import sys
from math import *

def minp():
	return sys.stdin.readline().strip()

def mint():
	return int(minp())

def mints():
	return map(int, minp().split())

n = mint()
a, b = mints()
t = list(mints())
c = [0]*n
for i in range(n):
	c[i] = (t[i] if a != b else 0, -i if a<b else i)
c.sort(reverse=a<b)
f = [0]*n
for i in range(a):
	f[abs(c[i][1])] = 1
for i in range(a,a+b):
	f[abs(c[i][1])] = 2
print(*f)


n = int(input())
a, b = map(int, input().split())
if a == b: print('1 ' * a + '2 ' * b)
else:
    t = [[] for i in range(6)]
    for i, j in enumerate(map(int, input().split())): t[j].append(i)
    if b < a:
        t = t[1] + t[2] + t[3] + t[4] + t[5]
        t.reverse()
        p = ['1'] * n
        for i in range(b): p[t[i]] = '2'
        print(' '.join(p))
    else:
        t = t[5] + t[4] + t[3] + t[2] + t[1]
        p = ['2'] * n
        for i in range(a): p[t[i]] = '1'
        print(' '.join(p))


import sys

n=int(sys.stdin.readline())

a,b=map(int,sys.stdin.readline().split())

marks=list(map(int,sys.stdin.readline().split()))

if(a==b):
    sys.stdout.write('1 '*(n//2)+'2 '*(n//2-1)+'2')

else:
    Ans=[2]*n
    if(a>b):
        sorted_marks=sorted(marks)
        for i in range(n):
            if(a>0 and marks[i]<=sorted_marks[a-1]):
                a-=1
                Ans[i]=1
    else:
        sorted_marks=sorted(marks,reverse=True)
        for i in range(n):
            if(a>0 and marks[i]>=sorted_marks[a-1]):
                a-=1
                Ans[i]=1
    for i in range(n-1):
        sys.stdout.write(str(Ans[i])+" ")
    sys.stdout.write(str(Ans[n-1]))


import sys

n=int(sys.stdin.readline())

a,b=map(int,sys.stdin.readline().split())

marks=list(map(int,sys.stdin.readline().split()))

Indices_of_marks={}
Order={}

if(a==b):
    sys.stdout.write('1 '*(n//2)+'2 '*(n//2-1)+'2')

for item in marks:
    Indices_of_marks[item]=()
    Order[item]=0
for i in range(n):
    Indices_of_marks[marks[i]]+=(i,)

else:
    Ans=[2]*n
    if(a>b):
        sorted_marks=sorted(marks)
        for i in range(a):
            Ans[Indices_of_marks[sorted_marks[i]][Order[sorted_marks[i]]]]=1
            Order[sorted_marks[i]]+=1
    else:
        sorted_marks=sorted(marks,reverse=True)
        for i in range(a):
            Ans[Indices_of_marks[sorted_marks[i]][Order[sorted_marks[i]]]]=1
            Order[sorted_marks[i]]+=1
    for i in range(n-1):
        sys.stdout.write(str(Ans[i])+" ")
    sys.stdout.write(str(Ans[n-1]))


import sys

n=int(sys.stdin.readline())

a,b=map(int,sys.stdin.readline().split())

marks=list(map(int,sys.stdin.readline().split()))

Indices_of_marks={}
Order={}

if(a==b):
    sys.stdout.write('1 '*(n//2)+'2 '*(n//2-1)+'2')

else:
    Ans=[2]*n
    if(a>b):
        sorted_marks=sorted(marks)
        for i in range(n):
            if(a>0 and marks[i]>=sorted_marks[a-1]):
                a-=1
                Ans[i]=1
    else:
        sorted_marks=sorted(marks,reverse=True)
        for i in range(a):
            if(a>0 and marks[i]<=sorted_marks[a-1]):
                a-=1
                Ans[i]=1
    for i in range(n-1):
        sys.stdout.write(str(Ans[i])+" ")
    sys.stdout.write(str(Ans[n-1]))


import sys

n=int(sys.stdin.readline())

a,b=map(int,sys.stdin.readline().split())

marks=list(map(int,sys.stdin.readline().split()))

Indices_of_marks={}
Order={}

if(a==b):
    sys.stdout.write('1 '*(n//2)+'2 '*(n//2-1)+'2')

else:
    for item in marks:
        Indices_of_marks[item]=()
        Order[item]=0
    for i in range(n):
        Indices_of_marks[marks[i]]+=(i,)
    Ans=[2]*n
    if(a>b):
        sorted_marks=sorted(marks)
        for i in range(a):
            Ans[Indices_of_marks[sorted_marks[i]][Order[sorted_marks[i]]]]=1
            Order[sorted_marks[i]]+=1
    else:
        sorted_marks=sorted(marks,reverse=True)
        for i in range(a):
            Ans[Indices_of_marks[sorted_marks[i]][Order[sorted_marks[i]]]]=1
            Order[sorted_marks[i]]+=1
    for i in range(n-1):
        sys.stdout.write(str(Ans[i])+" ")
    sys.stdout.write(str(Ans[n-1]))


import sys

n=int(sys.stdin.readline())

a,b=map(int,sys.stdin.readline().split())

marks=list(map(int,sys.stdin.readline().split()))

if(a==b):
    sys.stdout.write('1 '*(n//2)+'2 '*(n//2-1)+'2')

else:
    Ans=[2]*n
    if(a>b):
        sorted_marks=sorted(marks)
        x=0
        xx=0
        nn=sorted_marks[:a].count(sorted_marks[a-1])
        for i in range(n):
            if(x<a and marks[i]<=sorted_marks[a-1]):
                if(marks[i]==sorted_marks[a-1] and xx!=nn):
                    x+=1
                    Ans[i]=1
                    xx+=1
                elif(marks[i]!=sorted_marks[a-1]):
                    x+=1
                    Ans[i]=1
    else:
        sorted_marks=sorted(marks,reverse=True)
        x=0
        xx=0
        nn=sorted_marks[:a].count(sorted_marks[a-1])
        for i in range(n):
            if(x<a and marks[i]>=sorted_marks[a-1]):
                if(marks[i]==sorted_marks[a-1] and xx!=nn):
                    x+=1
                    Ans[i]=1
                    xx+=1
                elif(marks[i]!=sorted_marks[a-1]):
                    x+=1
                    Ans[i]=1
    for i in range(n-1):
        sys.stdout.write(str(Ans[i])+" ")
    sys.stdout.write(str(Ans[n-1]))


import sys

n=int(sys.stdin.readline())

a,b=map(int,sys.stdin.readline().split())

marks=list(map(int,sys.stdin.readline().split()))

if(a==b):
    sys.stdout.write('1 '*(n//2)+'2 '*(n//2-1)+'2')

else:
    Ans=[2]*n
    if(a>b):
        sorted_marks=sorted(marks)
        x=0
        for i in range(n):
            if(x<a and marks[i]<=sorted_marks[a-1]):
                x+=1
                Ans[i]=1
    else:
        sorted_marks=sorted(marks,reverse=True)
        x=0
        xx=0
        nn=sorted_marks[:a].count(sorted_marks[a-1])
        for i in range(n):
            if(x<a and marks[i]>=sorted_marks[a-1]):
                if(marks[i]==sorted_marks[a-1] and xx!=nn):
                    x+=1
                    Ans[i]=1
                    xx+=1
                elif(marks[i]!=sorted_marks[a-1]):
                    x+=1
                    Ans[i]=1
    for i in range(n-1):
        sys.stdout.write(str(Ans[i])+" ")
    sys.stdout.write(str(Ans[n-1]))


import sys

n=int(sys.stdin.readline())

a,b=map(int,sys.stdin.readline().split())

marks=list(map(int,sys.stdin.readline().split()))

if(a==b):
    sys.stdout.write('1 '*(n//2)+'2 '*(n//2-1)+'2')

else:
    Ans=[2]*n
    if(a>b):
        sorted_marks=sorted(marks)
        x=0
        for i in range(n):
            if(x<a and marks[i]<=sorted_marks[a-1]):
                x+=1
                Ans[i]=1
    else:
        sorted_marks=sorted(marks,reverse=True)
        x=0
        for i in range(n):
            if(x<a and marks[i]>=sorted_marks[a-1]):
                x+=1
                Ans[i]=1
    for i in range(n-1):
        sys.stdout.write(str(Ans[i])+" ")
    sys.stdout.write(str(Ans[n-1]))


import sys

n=int(sys.stdin.readline())

a,b=map(int,sys.stdin.readline().split())

marks=list(map(int,sys.stdin.readline().split()))

Indices_of_marks={}
Order={}

for item in set(marks):
    Indices_of_marks[item]=()
    Order[item]=0
for i in range(n):
    Indices_of_marks[marks[i]]+=(i,)

if(a==b):
    sys.stdout.write('1 '*(n//2))
    sys.stdout.write('2 '*(n//2-1))
    sys.stdout.write('2')

else:
    Ans=[2]*n
    if(a>b):
        sorted_marks=sorted(marks)
        for i in range(a):
            Ans[Indices_of_marks[sorted_marks[i]][Order[sorted_marks[i]]]]=1
            Order[sorted_marks[i]]+=1
    else:
        sorted_marks=sorted(marks,reverse=True)
        for i in range(a):
            Ans[Indices_of_marks[sorted_marks[i]][Order[sorted_marks[i]]]]=1
            Order[sorted_marks[i]]+=1
    for i in range(n-1):
        sys.stdout.write(str(Ans[i])+" ")
    sys.stdout.write(str(Ans[n-1]))


n=int(input())
a,b=list(map(int,input().split()))
arr=list(map(int,input().split()))
if a==b:
    print("1 "*a +"2 "*(a-1)+ "2")
else:
    arr=[(j,i) for i,j in enumerate(arr)]
    if a<b:
        ans=[1]*(n)
        arr.sort(key=lambda x :(x[0],-x[1]))
        for i in range(b):
            ans[arr[i][1]]=2

    else:
        ans=[2]*n
        arr.sort(key=lambda x :(x[0]))
        for i in range(a):
            ans[arr[i][1]]=1
    print(ans)


n=int(input())
a,b=list(map(int,input().split()))
arr=list(map(int,input().split()))
if a==b:
    print("1 "*a +"2 "*(a-1)+ "2")
else:
    arr=[(j,i) for i,j in enumerate(arr)]
    if a<b:
        ans=[1]*(n)
        arr.sort(key=lambda x :(x[0],-x[1]))
        for i in range(b):
            ans[arr[i][1]]=2

    else:
        ans=[2]*n
        arr.sort(key=lambda x :(x[0]))
        for i in range(a):
            ans[arr[i][1]]=1
    print((" ").join(map(str,ans)))


n=int(input())
a,b= input().split()
a=int(a)
b=int(b)
arr= list(map(int,input().split()))
arr1= arr.copy()
def find_min(num1,num2):
    if num1<num2:
        return num1
    else:
        return num2

min_value= find_min(a,b)
arr1.sort()
min_arr = arr1[n-min_value:]
result=[0]*n
if min_value==a:
    for i in min_arr:
        index_value=arr.index(i)
        result[index_value]=1
    for j in range(len(result)):
        if result[j]==0:
            result[j]=2
    for k in result:
        print(k,end=" ")
else:
    for i in min_arr:
        index_value=arr.index(i)
        result[index_value]=2
    for j in range(len(result)):
        if result[j]==0:
            result[j]=1
    for k in result:
        print(k,end=" ")


from operator import itemgetter
n=int(input())
a,b= input().split()
a=int(a)
b=int(b)
arr= list(map(int,input().split()))
arr = list(enumerate(arr,0))
arr.sort(key=itemgetter(1))

def find_min(num1,num2):
    if num1<num2:
        return num1
    else:
        return num2

min_value= find_min(a,b)
max_arr = arr[n-min_value:]
min_arr= arr[:n-min_value]
result=[0]*n
if min_value==a:
    for i in max_arr:
        index_value=i[0]
        result[index_value]=1
    for j in min_arr:
        index_value=j[0]
        result[index_value]=2
    for k in result:
        print(k,end=" ")
else:
    for i in min_arr:
        index_value=i[0]
        result[index_value]=1
    for j in max_arr:
        index_value=j[0]
        result[index_value]=2
    for k in result:
        print(k,end=" ")


from operator import itemgetter
n=int(input())
a,b= input().split()
a=int(a)
b=int(b)
arr= list(map(int,input().split()))
arr = list(enumerate(arr,0))
arr.sort(key=itemgetter(1))

def find_min(num1,num2):
    if num1<num2:
        return num1
    else:
        return num2

result=[0]*n
if a==b:
    for i in range(a):
        result[i]=1
    for j in range(len(result)):
        if result[j]==0:
            result[j]=2
    for k in result:
            print(k,end=" ")
else:
    min_value= find_min(a,b)
    max_arr = arr[n-min_value:]
    min_arr= arr[:n-min_value]
    result=[0]*n
    if min_value==a:
        for i in max_arr:
            index_value=i[0]
            result[index_value]=1
        for j in min_arr:
            index_value=j[0]
            result[index_value]=2
        for k in result:
            print(k,end=" ")
    else:
        for i in min_arr:
            index_value=i[0]
            result[index_value]=1
        for j in max_arr:
            index_value=j[0]
            result[index_value]=2
        for k in result:
            print(k,end=" ")


from operator import itemgetter
from collections import defaultdict
n=int(input())
a,b= map(int,input().split())
arr= list(map(int,input().split()))
arr = list(enumerate(arr,0))
arr=sorted(arr,key=itemgetter(1),reverse=True)

def find_min(num1,num2):
    if num1<num2:
        return num1
    else:
        return num2
result=[0]*n

if a==b:
    for i in range(a):
        result[i]=1
    for j in range(a,n):
        if result[j]==0:
            result[j]=2
elif a>b:
    dicta=defaultdict(list)
    for i in range(n):
        dicta[arr[i][1]].append(arr[i][0])
    for j in range(b,n):
        print(dicta[arr[j][1]])
        result[dicta[arr[j][1]][0]]=1
        dicta[arr[j][1]].pop(0)
    for k in range(b):
        result[dicta[arr[k][1]][0]]=2
        dicta[arr[k][1]].pop(0)

else:
    min_value= find_min(a,b)
    if min_value==a:
        second_range=b
        val=1
    else:
        second_range=a
        val=2
    for i in range(min_value):
        result[arr[i][0]] = val
    if val==1:
        new_val=2
    else:
        new_val=1
    for j in range(min_value,n):
        result[arr[j][0]]=new_val

for l in result:
    print(l,end=" ")

    # max_arr = arr[n-min_value:]
    # min_arr= arr[:n-min_value]
    # if min_value==a:
    #     for i in max_arr:
    #         result[i[0]]=1
    #     for j in min_arr:
    #         result[j[0]]=2
    #     for k in result:
    #         print(k,end=" ")
    # else:
    #     for i in min_arr:
    #         result[i[0]]=1
    #     for j in max_arr:
    #         result[j[0]]=2
    #     for k in result:
    #         print(k,end=" ")


from operator import itemgetter
from collections import defaultdict
n=int(input())
a,b= map(int,input().split())
arr= list(map(int,input().split()))
arr = list(enumerate(arr,0))
arr=sorted(arr,key=itemgetter(1),reverse=True)

def find_min(num1,num2):
    if num1<num2:
        return num1
    else:
        return num2
result=[0]*n

if a==b:
    for i in range(a):
        result[i]=1
    for j in range(a,n):
        if result[j]==0:
            result[j]=2
elif a>b:
    dicta=defaultdict(list)
    for i in range(n):
        dicta[arr[i][1]].append(arr[i][0])
    for j in range(b,n):
        result[dicta[arr[j][1]][0]]=1
        dicta[arr[j][1]].pop(0)
    for k in range(b):
        result[dicta[arr[k][1]][0]]=2
        dicta[arr[k][1]].pop(0)

else:
    min_value= find_min(a,b)
    if min_value==a:
        second_range=b
        val=1
    else:
        second_range=a
        val=2
    for i in range(min_value):
        result[arr[i][0]] = val
    if val==1:
        new_val=2
    else:
        new_val=1
    for j in range(min_value,n):
        result[arr[j][0]]=new_val

for l in result:
    print(l,end=" ")

    # max_arr = arr[n-min_value:]
    # min_arr= arr[:n-min_value]
    # if min_value==a:
    #     for i in max_arr:
    #         result[i[0]]=1
    #     for j in min_arr:
    #         result[j[0]]=2
    #     for k in result:
    #         print(k,end=" ")
    # else:
    #     for i in min_arr:
    #         result[i[0]]=1
    #     for j in max_arr:
    #         result[j[0]]=2
    #     for k in result:
    #         print(k,end=" ")


import sys
from itertools import *
from math import *
def solve():
    n = int(input())
    a, b = map(int, input().split())
    if a == b:
        for i in range(a): print(1, end = ' ')
        for i in range(a): print(2, end = ' ')
        return
    first = 2
    if a > b:
        a, b = b, a
        first = 1
    l = list(map(int, input().split()))
    lobjs = [(i, val) for i, val in enumerate(l)]
    lobjs.sort(key = lambda j: (j[1], j[0] if first == 1 else -j[0]), reverse = True)
    res = [0] * n
    for index, obj in enumerate(lobjs):
        if index < a: res[obj[0]] = 3 - first
        else: res[obj[0]] = first
    print(' '.join(map(str, res)))

if sys.hexversion == 50594544 : sys.stdin = open("test.txt")
solve()


import sys
from itertools import *
from math import *
def solve():
    n = int(input())
    a, b = map(int, input().split())
    if a > b: a, b = b, a
    l = list(map(int, input().split()))
    lobjs = [(i, val) for i, val in enumerate(l)]
    lobjs.sort(key = lambda j: j[1], reverse = True)
    res = [0] * n
    for index, obj in enumerate(lobjs):
        if index < a: res[obj[0]] = 1
        else: res[obj[0]] = 2
    print(' '.join(map(str, res)))

if sys.hexversion == 50594544 : sys.stdin = open("test.txt")
solve()


import sys
from itertools import *
from math import *
def solve():
    n = int(input())
    a, b = map(int, input().split())
    if a == b:
        for i in range(a): print(1, end = ' ')
        for i in range(a): print(2, end = ' ')
        return
    if a > b: a, b = b, a
    l = list(map(int, input().split()))
    lobjs = [(i, val) for i, val in enumerate(l)]
    lobjs.sort(key = lambda j: (j[1], j[0]), reverse = True)
    res = [0] * n
    for index, obj in enumerate(lobjs):
        if index < a: res[obj[0]] = 2
        else: res[obj[0]] = 1
    print(' '.join(map(str, res)))

if sys.hexversion == 50594544 : sys.stdin = open("test.txt")
solve()


import sys
from itertools import *
from math import *
def solve():
    n = int(input())
    a, b = map(int, input().split())
    if a == b:
        for i in range(a): print(1, end = ' ')
        for i in range(a): print(2, end = ' ')
        return
    first = 2
    if a > b:
        a, b = b, a
        first = 1
    l = list(map(int, input().split()))
    lobjs = [(i, val) for i, val in enumerate(l)]
    lobjs.sort(key = lambda j: (j[1], -j[0]), reverse = True)
    res = [0] * n
    for index, obj in enumerate(lobjs):
        if index < a: res[obj[0]] = 3 - first
        else: res[obj[0]] = first
    print(' '.join(map(str, res)))

if sys.hexversion == 50594544 : sys.stdin = open("test.txt")
solve()


import sys
from itertools import *
from math import *
def solve():
    n = int(input())
    a, b = map(int, input().split())
    if a == b:
        for i in range(a): print(1, end = ' ')
        for i in range(a): print(2, end = ' ')
        return
    first = 2
    if a > b:
        a, b = b, a
        first = 1
    l = list(map(int, input().split()))
    lobjs = [(i, val) for i, val in enumerate(l)]
    lobjs.sort(key = lambda j: (j[1], j[0]), reverse = True)
    res = [0] * n
    for index, obj in enumerate(lobjs):
        if index < a: res[obj[0]] = 3 - first
        else: res[obj[0]] = first
    print(' '.join(map(str, res)))

if sys.hexversion == 50594544 : sys.stdin = open("test.txt")
solve()


n = int(input())
a, b = map(int, input().split())
if a == b: print('1 ' * a + '2 ' * b)
else:
    t = [[] for i in range(6)]
    for i, j in enumerate(map(int, input().split())): t[j].append(i)
    if b < a:
        t = t[1] + t[2] + t[3] + t[4] + t[5]
        t.reverse()
        p = ['1'] * n
        for i in range(b): p[t[i]] = '2'
        print(' '.join(p))
    else:
        t = t[5] + t[4] + t[3] + t[2] + t[1]
        p = ['2'] * n
        for i in range(a): p[t[i]] = '1'
        print(' '.join(p))


n = int(input())
a, b = map(int, input().split())
if a == b: print('1 ' * a + '2 ' * b)
else:
    t = [[] for i in range(6)]
    for i, j in enumerate(map(int, input().split())): t[j].append(i)
    if b < a:
        t = t[1] + t[2] + t[4] + t[5]
        t.reverse()
        p = ['1'] * n
        for i in range(b): p[t[i]] = '2'
        print(' '.join(p))
    else:
        t = t[5] + t[4] + t[3] + t[2] + t[1]
        p = ['2'] * n
        for i in range(a): p[t[1]] = '1'
        print(' '.join(p))


n = int(input())
a, b = map(int, input().split())
t = [[] for i in range(6)]
for i, j in enumerate(map(int, input().split())): t[j].append(i)
t = t[5] + t[4] + t[3] + t[2] + t[1]
p = ['1'] * n
for i in range(min(a, b)): p[t[i]] = '2'


n = int(input())
a, b = map(int, input().split())
t = [[] for i in range(6)]
for i, j in enumerate(map(int, input().split())): t[j].append(i)
t = t[5] + t[4] + t[3] + t[2] + t[1]
p = ['1'] * n
for i in range(min(a, b)): p[t[i]] = '2'
print(' '.join(p))


n = int(input())
a, b = map(int, input().split())
if a == b: print('1 ' * a + '2 ' * b)
else:
    t = [[] for i in range(6)]
    for i, j in enumerate(map(int, input().split())): t[j].append(i)
    t = t[1] + t[2] + t[4] + t[5]
    t.reverse()
    p = ['1'] * n
    for i in range(min(a, b)): p[t[i]] = '2'
    print(' '.join(p))


n = int(input())
a, b = map(int, input().split())
if a == b: print('1 ' * a + '2 ' * b)
else:
    t = [[] for i in range(6)]
    for i, j in enumerate(map(int, input().split())): t[j].append(i)
    if b < a:
        t = t[1] + t[2] + t[4] + t[5]
        t.reverse()
        p = ['1'] * n
        for i in range(b): p[t[i]] = '2'
        print(' '.join(p))
    else:
        t = t[5] + t[4] + t[3] + t[2] + t[1]
        p = ['2'] * n
        for i in range(a): p[t[i]] = '1'
        print(' '.join(p))


import sys
from itertools import *
from math import *
def solve():
    n = int(input())
    a, b = map(int, input().split())
    if a == b:
        for i in range(a): print(1, end = ' ')
        for i in range(a): print(2, end = ' ')
        return
    first = 2
    if a > b:
        a, b = b, a
        first = 1
    l = list(map(int, input().split()))
    lobjs = [(i, val) for i, val in enumerate(l)]
    lobjs.sort(key = lambda j: (j[1], j[0] if first == 1 else -j[0]), reverse = True)
    res = [0] * n
    for index, obj in enumerate(lobjs):
        if index < a: res[obj[0]] = 3 - first
        else: res[obj[0]] = first
    print(' '.join(map(str, res)))

if sys.hexversion == 50594544 : sys.stdin = open("test.txt")
solve()

# Made By Mostafa_Khaled


import random, math
from copy import deepcopy as dc

# To Genrate Random Number for Test-Cases
def randomNumber(s, e):
	return random.randint(s, e)

# To Generate Random Array for Test-Cases
def randomArray(s, e, s_size, e_size):
	size = random.randint(s_size, e_size)
	arr = [randomNumber(s, e) for i in range(size)]
	return arr

# To Generate Question Specific Test-Cases
def testcase():
	pass

# Brute Force Approach to check Solution
def brute():
	pass

# Efficient Approach for problem
def effe():
	pass

# Function to call the actual solution
def solution(li, a, b):
	li1 = [[li[i], i] for i in range(len(li))]
	li1.sort(key = lambda x: (x[0], x[1]))
	li2 = [0 for i in range(len(li))]
	# print(li1)
	if a < b:
		for i in range(len(li) - a):
			li2[li1[i][1]] = 2
		for i in range(len(li)-a, len(li)):
			li2[li1[i][1]] = 1
	elif a == b:
		flag = True
		for i in range(len(li)-a):
			li2[i] = 1
		for i in range(len(li)-a, len(li)):
			li2[i] = 2
	else:
		for i in range(len(li) - b):
			li2[li1[i][1]] = 1
		for i in range(len(li)-b, len(li)):
			li2[li1[i][1]] = 2
	return li2

# Function to take input
def input_test():
	n = int(input())
	a, b = map(int, input().strip().split(" "))
	li = list(map(int, input().strip().split(" ")))
	out = solution(li, a, b)
	print(' '.join(list(map(str, out))))

# Function to check test my code
def test():
	pass

input_test()
# test()


import random, math
from copy import deepcopy as dc

# To Genrate Random Number for Test-Cases
def randomNumber(s, e):
	return random.randint(s, e)

# To Generate Random Array for Test-Cases
def randomArray(s, e, s_size, e_size):
	size = random.randint(s_size, e_size)
	arr = [randomNumber(s, e) for i in range(size)]
	return arr

# To Generate Question Specific Test-Cases
def testcase():
	pass

# Brute Force Approach to check Solution
def brute():
	pass

# Efficient Approach for problem
def effe():
	pass

# Function to call the actual solution
def solution(li, a, b):
	li1 = [[li[i], i] for i in range(len(li))]
	n = len(li)
	li3 = sorted(li1, key = lambda x: (x[0], x[1]))
	li1 = sorted(li1, key = lambda x: (x[0], n-x[1]))
	li2 = [0 for i in range(len(li))]
	# print(li1)
	if a < b:
		for i in range(len(li) - a):
			li2[li1[i][1]] = 2
		for i in range(len(li)-a, len(li)):
			li2[li1[i][1]] = 1
	elif a == b:
		flag = True
		for i in range(len(li)-a):
			li2[i] = 1
		for i in range(len(li)-a, len(li)):
			li2[i] = 2
	else:
		for i in range(len(li) - b):
			li2[li3[i][1]] = 1
		for i in range(len(li)-b, len(li)):
			li2[li3[i][1]] = 2
	return li2

# Function to take input
def input_test():
	n = int(input())
	a, b = map(int, input().strip().split(" "))
	li = list(map(int, input().strip().split(" ")))
	out = solution(li, a, b)
	print(' '.join(list(map(str, out))))

# Function to check test my code
def test():
	pass

input_test()
# test()


import random, math
from copy import deepcopy as dc

# To Genrate Random Number for Test-Cases
def randomNumber(s, e):
	return random.randint(s, e)

# To Generate Random Array for Test-Cases
def randomArray(s, e, s_size, e_size):
	size = random.randint(s_size, e_size)
	arr = [randomNumber(s, e) for i in range(size)]
	return arr

# To Generate Question Specific Test-Cases
def testcase():
	pass

# Brute Force Approach to check Solution
def brute():
	pass

# Efficient Approach for problem
def effe():
	pass

# Function to call the actual solution
def solution(li, a, b):
	li1 = [[li[i], i] for i in range(len(li))]
	li1.sort(key = lambda x: (x[0], x[1]))
	li2 = [0 for i in range(len(li))]
	# print(li1)
	if a < b:
		for i in range(len(li) - a):
			li2[li1[i][1]] = 2
		for i in range(len(li)-a, len(li)):
			li2[li1[i][1]] = 1
	elif a == b:
		flag = True
		for i in range(len(li)):
			if flag:
				li2[li1[i][1]] = 1
				flag = False
			else:
				li2[li1[i][1]] = 2
				flag = True
	else:
		for i in range(len(li) - b):
			li2[li1[i][1]] = 1
		for i in range(len(li)-b, len(li)):
			li2[li1[i][1]] = 2
	return li2

# Function to take input
def input_test():
	n = int(input())
	a, b = map(int, input().strip().split(" "))
	li = list(map(int, input().strip().split(" ")))
	out = solution(li, a, b)
	print(' '.join(list(map(str, out))))

# Function to check test my code
def test():
	pass

input_test()
# test()


cin = lambda: map(int, raw_input().split())
n = input()
a, b = cin()
v = cin()
ans = [1] * n
t = []
if a > b:
    for i, x in enumerate(v):
        t.append((i, x))
    t.sort(lambda x, y: y[1] - x[1] or y[0] - x[0])
    for i in xrange(b):
        ans[t[i][0]] = 2
elif a < b:
    for i, x in enumerate(v):
        t.append((i, x))
    t.sort(lambda x, y: x[1] - y[1] or y[0] - x[0])
    for i in xrange(b):
        ans[t[i][0]] = 2
else:
    for i, x in enumerate(v):
        t.append((i, x))
    t.sort(lambda x, y: y[0] - x[0])
    for i in xrange(b):
        ans[t[i][0]] = 2
print ' '.join(map(str, ans))


cin = lambda: map(int, raw_input().split())
n = input()
a, b = cin()
v = cin()
ans = [1] * n
t = []
if a > b:
    for i, x in enumerate(v):
        t.append((i, x))
    t.sort(lambda x, y: y[1] - x[1] or y[0] - x[0])
    for i in xrange(b):
        ans[t[i][0]] = 2
elif a < b:
    for i, x in enumerate(v):
        t.append((i, x))
    t.sort(lambda x, y: x[1] - y[1] or y[0] - x[0])
    for i in xrange(b):
        ans[t[i][0]] = 2
else:
    for i, x in enumerate(v):
        t.append((i, x))
    t.sort(lambda x, y: y[0] - x[0])
    for i in xrange(b):
        ans[t[i][0]] = 2
print ' '.join(ans)


cin = lambda: map(int, raw_input().split())
n = input()
a, b = cin()
v = cin()
ans = [1] * n
t = []
if a > b:
    for i, x in enumerate(v):
        t.append((i, x))
    t.sort(lambda x, y: y[1] - x[1] or y[0] - x[0])
    for i in xrange(b):
        ans[t[i][0]] = 2
elif a < b:
    for i, x in enumerate(v):
        t.append((i, x))
    t.sort(lambda x, y: x[1] - y[1] or y[0] - x[0])
    for i in xrange(b):
        ans[t[i][0]] = 2
else:
    for i, x in enumerate(v):
        t.append((i, x))
    t.sort(lambda x, y: y[0] - x[0])
    for i in xrange(b):
        ans[t[i][0]] = 2
print ans


cin = lambda: map(int, raw_input().split())
n = input()
a, b = cin()
v = cin()
ans = [1] * n
t = []
if a > b:
    for i, x in enumerate(v):
        t.append((i, x))
    t.sort(lambda x, y: y[1] - x[1] or y[0] - x[0])
    for i in xrange(b):
        ans[t[i][0]] = 2
elif a < b:
    for i, x in enumerate(v):
        t.append((i, x))
    t.sort(lambda x, y: x[1] - y[1] or y[0] - x[0])
    for i in xrange(b):
        ans[t[i][0]] = 2
else:
    for i, x in enumerate(v):
        t.append((i, x))
    t.sort(lambda x, y: y[0] - x[0])
    for i in xrange(b):
        ans[t[i][0]] = 2
print ' '.join(ans.split())


def comp(a, b):
    if a[0] < b[0] or a[0] == b[0] and a[1] > b[1]:
        return -1
    elif a[0] == b[0] and a[1] == b[1]:
        return 0
    else:
        return 1

n = int(raw_input())
x, y = map(int, raw_input().split())
if x == y:
    for i in range(x):
        print 1,
    for i in range(y):
        print 2,
    exit()
a = map(int, raw_input().split())
for i in range(n):
    a[i] = (a[i], i)
if x < y:
    a.sort(comp)
    for i in range(y):
        a[i] = (a[i][1], 2)
    for i in range(x):
        a[-i - 1] = (a[-i - 1][1], 1)
elif x > y:
    a.sort()
    for i in range(x):
        a[i] = (a[i][1], 1)
    for i in range(y):
        a[-i - 1] = (a[-i - 1][1], 2)
a.sort()
for k in a:
    print k[1],


n = int(raw_input())
x, y = map(int, raw_input().split())
a = map(int, raw_input().split())
for i in range(n):
    a[i] = (a[i], i)
a.sort()
if x < y:
    for i in range(y):
        a[i] = (a[i][1], 2)
    for i in range(x):
        a[-i - 1] = (a[-i - 1][1], 1)
else:
    for i in range(x):
        a[i] = (a[i][1], 1)
    for i in range(y):
        a[-i - 1] = (a[-i - 1][1], 2)
a.sort()
for k in a:
    print k[1],


n = int(raw_input())
x, y = map(int, raw_input().split())
if x == y:
    for i in range(x):
        print 1,
    for i in range(y):
        print 2,
    exit()
a = map(int, raw_input().split())
for i in range(n):
    a[i] = (a[i], i)
a.sort()
if x < y:
    for i in range(y):
        a[i] = (a[i][1], 2)
    for i in range(x):
        a[-i - 1] = (a[-i - 1][1], 1)
elif x > y:
    for i in range(x):
        a[i] = (a[i][1], 1)
    for i in range(y):
        a[-i - 1] = (a[-i - 1][1], 2)
a.sort()
for k in a:
    print k[1],


f=lambda:map(int,raw_input().split())
n,(a,b),t=f(),f(),f()
s=[sorted(t,reverse=a<b),t][a==b][:a]
c=[[1]*s.count(i)for i in range(6)]
for x in t:print c[x]and(c[x].pop())or 2,


from sys import stdin

inn = int(stdin.next())
a,b = map(int, stdin.next().split())
m = map(int, stdin.next().split())

def calc(mb, ms, ns):
	sg = -1 if mb < ms else 1

	mi = sorted([ (e, i * sg) for i,e in enumerate(m) ])

	outIdx = [ (i*sg, ms) for e,i in mi[:ns] ]
	outIdx.extend([ (i*sg, mb) for e,i in mi[ns:] ])

	return [ e for i,e in sorted(outIdx) ]

if a > b:
	out = calc(2, 1, a)
elif a < b:
	out = calc(1, 2, b)
else:
	out = [1] * a + [2] * b

print ' '.join(map(str, out))


from sys import stdin

n = int(stdin.next())
a,b = map(int, stdin.next().split())
m = map(int, stdin.next().split())

if a > b:
	mb,ms = (2, 1)
	m = reversed(m)
	ns = a
else:
	mb,ms = (1, 2)
	ns = b

mi = sorted([ (e, i) for i,e in enumerate(m) ])

outIdx = [ (i, ms) for e,i in mi[:ns] ]
outIdx.extend([ (i, mb) for e,i in mi[ns:] ])

out = [ e for i,e in sorted(outIdx) ]

print ' '.join(map(str, out))


n = int(raw_input())
(a, b) = map(int, raw_input().split())
if a == b:
	print ("1 " * a) + ("2 " * a)
	exit(0)
t = map(int, raw_input().split())
s = []
for (p, x) in enumerate(t):
	s.append((x, p if a > b else -p))
s.sort()

if a < b:
	res = [1] * n
	for i in xrange(b):
		res[-s[i][1]] = 2
else:
	res = [2] * n
	for i in xrange(a):
		res[s[i][1]] = 1
print " ".join(map(str, res))


f=lambda:map(int,raw_input().split())
n,(a,b),t=f(),f(),f()
s=[sorted(t,reverse=a<b),t][a==b][:a]
for x in t:print x in s and(s.remove(x)or 1)or 2,


n = input()
a,b = map(int,raw_input().split())
t = map(int,raw_input().split())
if a>b:
    st = sorted(t)[:a]
    m = max(st)
    mc = st.count(m)
    res = []
    for x in t:
        if a>0 and (x<m or (x==m and mc>0)) :
            res.append(1)
            a-=1
            if x==m: mc-=1
        else:
            res.append(2)
elif a<b:
    st = sorted(t)[b:]
    m = min(st)
    mc = st.count(m)
    res = []
    for x in t:
        if a>0 and (x>m or (x==m and mc>0)) :
            res.append(1)
            a-=1
            if x==m: mc-=1
        else:
            res.append(2)
else:
    res = [1]*a+[2]*b
print ' '.join(map(str,res))


n = input()
a,b = map(int,raw_input().split())
t = map(int,raw_input().split())
if a>b:
    m = sorted(t)[a-1]
    res = []
    for x in t:
        if x<=m and a>0:
            res.append(1)
            a-=1
        else:
            res.append(2)
elif a<b:
    m = sorted(t)[b]
    res = []
    for x in t:
        if x>=m and a>0:
            res.append(1)
            a-=1
        else:
            res.append(2)
else:
    res = [1]*a+[2]*b
print ' '.join(map(str,res))


import sys

n = int(sys.stdin.next())
[n1, n2] = map(int, sys.stdin.next().split())
marks = zip(map(int, sys.stdin.next().split()), xrange(n))

a = [0]*n
if n1 < n2:
  marks = sorted(marks, cmp=lambda x, y: -cmp(x[0], y[0]) or cmp(x[1], y[1]))
elif n1 > n2:
  marks = sorted(marks, cmp=lambda x, y: cmp(x[0], y[0]) or cmp(x[1], y[1]))

for _, i in marks[:n1]:
  a[i] = 1
for _, i in marks[n1:]:
  a[i] = 2

print " ".join(map(str, a))


n=int(raw_input())
s=raw_input().split()
a=int(s[0])
b=int(s[1])

A=[(int(x),i) for i,x in enumerate(raw_input().split())]

def imprime(a):
	for i in range(len(a)-1):
		print a[i],
	print a[len(a)-1]

if a==b:
	imprime([1]*a+[2]*b)

else:
	val=2
	if a<b:
		(a,b)=(b,a)
		val=1
	A.sort()
	r=[val]*n
	for i in range(a):
		r[A[i][1]]=1+(2-val)
	imprime(r)


n=int(raw_input())
s=raw_input().split()
a=int(s[0])
b=int(s[1])

A=[(int(x),i) for i,x in enumerate(raw_input().split())]

def imprime(a):
	for i in range(len(a)-1):
		print a[i],
	print a[len(a)-1]

def order(a,b):
	if a[0]==b[0]:
		if(a[1]>b[1]):
			return -1
		return 1
	if a[0]<b[0]:
		return -1
	return 1

if a==b:
	imprime([1]*a+[2]*b)

else:
	if a>b:
		A.sort()
		r=[2]*n
		for i in range(a):
			r[A[i][1]]=1
		imprime(r)
	else:
		A.sort(cmp=order)
		r=[1]*n
		for i in range(b):
			r[A[i][1]]=2
		imprime(r)


import sys

n = int(raw_input())
a, b = raw_input().split()
a = int(a)
b = int(b)

c = [ int(x) for x in raw_input().split() ]
d = zip(c, range(0, n))
d.sort()

if a == b:
  print ' '.join(['1'] * a + ['2'] * b)
  sys.exit()

if a < b:
  for i in range (0, b):
    c[d[i][1]] = 2
  for i in range(b, n):
    c[d[i][1]] = 1
else:
  for i in range (0, a):
    c[d[i][1]] = 1
  for i in range(a, n):
    c[d[i][1]] = 2

print ' '.join([str(x) for x in c])


import sys

n = int(raw_input())
a, b = raw_input().split()
a = int(a)
b = int(b)

c = [ int(x) for x in raw_input().split() ]
if a < b:
  d = zip(c, range(n-1, -1, -1))
else:
  d = zip(c, range(0, n))
d.sort()

if a == b:
  print ' '.join(['1'] * a + ['2'] * b)
  sys.exit()

if a < b:
  for i in range (0, b):
    c[n - 1 - d[i][1]] = 2
  for i in range(b, n):
    c[n - 1 - d[i][1]] = 1
else:
  for i in range (0, a):
    c[d[i][1]] = 1
  for i in range(a, n):
    c[d[i][1]] = 2

print ' '.join([str(x) for x in c])


from itertools import islice
n = int(raw_input())
a,b = (int(s) for s in raw_input().split())
u = 1 - 2*( a < b )
if a == b:
    for i in xrange(a): print 1,
    for i in xrange(b): print 2,
    print
else:
    m =  [[int(s),u*i, 1 + ( a < b )] for i,s in enumerate(raw_input().split())]
    for c in islice(sorted(m,reverse = True),min(a,b)):
        c[2] = 1 + ( a > b )
    for i in m:   print i[2],


#!/usr/bin/python
# -*- coding: utf-8 -*-

from itertools import combinations

n = int(raw_input(''))
a,b = [int(x) for x in (raw_input('')).split(' ')]
s = [int(x) for x in (raw_input('')).split(' ')]

maxs = 0.0
res = None
maxst = ''

for c in combinations( xrange(0,n), a ):
    f = [ 0 for x in xrange(0,n) ]
    for t in c:
        f[t] = 1

    sum1 = 0
    sum2 = 0
    for i in xrange(0,n):
        if f[i] == 1:
            sum1 += s[i]
        else:
            sum2 += s[i]

    ss = float(sum1)/float(a) + float(sum2)/float(b) - 1e-8
    if ss >= maxs:
        st = ''.join( [ str(x) for x in f ] )
        if maxst == '' or st > maxst:
            maxs = ss
            maxst = st
            res = f[:]
            print f[:], ss, sum1, sum2, maxst

r = ''
i = 0
while i < len(res):
    if r != '':
        r += ' '
    r += str(2-res[i])
    i += 1

print r


#!/usr/bin/python
# -*- coding: utf-8 -*-

n = int(raw_input())
a,b = map(int, raw_input().split())
if a == b:
    print ( "1 " * a) + ( "2 " * a )
    exit( 0 )
t = [ int(x) for x in raw_input().split()]

s = []
for ( i, x ) in enumerate( t ):
    s.append( ( x,i if a > b else -i ) )
s.sort()

if a < b:
    res = [ 1 ] * n
    for i in xrange( b ):
        res[ -s[ i ][ 1 ] ] = 2
else:
    res = [ 2 ] * n
    for i in xrange( a ):
        res[ s[ i ][ 1 ] ]  = 1

print " ".join( map( str, res ) )


#!/usr/bin/python
# -*- coding: utf-8 -*-

from itertools import combinations

n = int(raw_input(''))
a,b = [int(x) for x in (raw_input('')).split(' ')]
s = [int(x) for x in (raw_input('')).split(' ')]

maxs = 0.0
res = None
maxst = ''

for c in combinations( xrange(0,n), a ):
    f = [ 0 for x in xrange(0,n) ]
    for t in c:
        f[t] = 1

    sum1 = 0
    sum2 = 0
    for i in xrange(0,n):
        if f[i] == 1:
            sum1 += s[i]
        else:
            sum2 += s[i]

    ss = float(sum1)*float(b) + float(sum2)*float(a)

    if ss == maxs:
        st = ''.join( [ str(2-x) for x in f ] )
        if st < maxst:
            maxst = st
            res = f[:]
 #           print 'u',f[:], ss, sum1, sum2, maxst
    elif ss-1e-8 > maxs:
        maxs = ss
        st = ''.join( [ str(2-x) for x in f ] )
        maxst = st
        res = f[:]
#        print f[:], ss, sum1, sum2, maxst

        maxs = ss
r = ''
i = 0
while i < len(res):
    if r != '':
        r += ' '
    r += str(2-res[i])
    i += 1

print r


#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
using namespace std;
typedef long long LL;
LL data[200005];
int main()
{
    int n;
    scanf("%d",&n);
    n=2*n;
    for(int i=1;i<=n;i++)
    {
        scanf("%I64d",&data[i]);
    }
    sort(data+1,data+n+1);
    LL ans=min((data[n]-data[n/2+1])*(data[n/2]-data[1]),(data[n]-data[1])*(data[n/2+1]-data[n/2]));
    printf("%I64d\n",ans);
    return 0;
}


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

int main()
{
    int n;
    cin >> n;
    int arr[2*n + 1];
    for(int i = 1 ; i <= 2*n ; i++)
    {
        cin >> arr[i];
    }

    sort(arr + 1 , arr + 2*n + 1);

    long long length =  arr[n] - arr[1];
    long long breadth = arr[2*n] - arr[n+1];
    //cout << length << " " << breadth ;
    long long area = length * breadth ;
    cout << area;
}


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

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

    int arr[2*n + 1];

    for(int i = 1 ; i < 2*n+1 ; i++)
      cin >> arr[i];

    sort( arr+1 , arr+2*n+1);

    int first = arr[1];
    int last = arr[2*n];

    int max = arr[2];
    int min = arr[2*n-1];
    for(int i = 1 ; i <= n ; i++)
    {
          if(max < arr[i])
          max = arr[i];
    }

    for(int i = n+1 ; i <= 2*n ; i++)
    {
        if(min > arr[i])
        min = arr[i];
    }

    long long ans = abs(first - max) * abs(last - min);
    cout << ans;
	return 0;
}


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

int main()
{
    int n;
    cin >> n;
    int arr[2*n + 1];
    for(int i = 1 ; i <= 2*n ; i++)
    {
        cin >> arr[i];
    }

    sort(arr + 1 , arr + 2*n + 1);

    long long length =  arr[n] - arr[1];
    long long breadth = arr[2*n] - arr[n+1];
    //cout << length << " " << breadth ;
    long long area1 = length * breadth ;

    int diff = 1e9 + 1;

    for(int i = 2 ; i <= n ; i++)
    {
        diff = min(diff , arr[i + n - 1] - arr[i]);
    }
    long long area2 = (arr[2*n] - arr[1]) * diff;
    long long ans =  min(area1 , area2);
    cout << ans;
}


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

int main()
{
    int n;
    cin >> n;
    int arr[2*n + 1];
    for(int i = 1 ; i <= 2*n ; i++)
    {
        cin >> arr[i];
    }

    sort(arr + 1 , arr + 2*n + 1);

    long long length =  arr[n] - arr[1];
    long long breadth = arr[2*n] - arr[n+1];
    //cout << length << " " << breadth ;
    long long area1 = length * breadth ;

    int diff = 1e9 + 1;

    for(int i = 2 ; i <= n ; i++)
    {
        diff = min(diff , arr[i + n - 1] - arr[i]);
    }
    long long area2 = (arr[2*n] - arr[1]) * diff;
    cout << min(area1 , area2);

}


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

int main()
{
    int n;
    cin >> n;
    long long  arr[2*n + 1];
    for(int i = 1 ; i <= 2*n ; i++)
    {
        cin >> arr[i];
    }

    sort(arr + 1 , arr + 2*n + 1);
    if(n == 1)
        cout << 0;
    else
    {
    long long length =  arr[n] - arr[1];
    long long breadth = arr[2*n] - arr[n+1];
    //cout << length << " " << breadth ;
    long long area1 = length * breadth ;

    long long  diff = 1e9 + 1;

    for(int i = 2 ; i <= n ; i++)
    {
        diff = min(diff , arr[i + n - 1] - arr[i]);
    }
    long long area2 = (arr[2*n] - arr[1]) * diff;
    long long ans =  min(area1 , area2);
    cout << ans;
    }
}


#include <map>
#include <set>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <algorithm>

using namespace std;

void write(long long x);

inline long long read()
{
    char c;
    long long out=0,f=1;
    for (c=getchar();(c<'0'||c>'9')&&c!='-';c=getchar());
    if (c=='-')
    {
    	f=-1;
    	c=getchar();
	}
    for (;c>='0'&&c<='9';c=getchar())
    {
        out=out*10+c-'0';
    }
    return out*f;
}

int n,a[200010];
long long ans;

int main()
{
	n=read();

	int i;

	for (i=0;i<2*n;++i)
	{
		a[i]=read();
	}

	sort(a,a+n*2);

	ans=1ll*(a[n-1]-a[0])*(a[n*2-1]-a[n]);

	for (i=1;i<n;++i)
	{
		ans=min(ans,1ll*(a[i+n-1]-a[i])*(a[n*2-1]-a[0]));
	}

	write(ans);

	return 0;
}

void write(long long x)
{
	if (x<0)
	{
		putchar('-');
		write(-x);
		return;
	}
    if (x>9)
    {
        write(x/10);
    }
    putchar(x%10+'0');
}


#include <bits/stdc++.h>

using namespace std;
int a[200010];
int main(){
	int n;
	scanf("%d", &n);
	for(int i = 0; i < 2 * n; i ++)scanf("%d", &a[i]);
	sort(a, a + 2*n);
	long long l, w;
	l = a[n - 1] - a[0];
	w = a[2*n - 1] - a[n];
	printf("%I64d", l*w);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
int a[200010];
int main(){
	int n;
	scanf("%d", &n);
	for(int i = 0; i < 2 * n; i ++)scanf("%d", &a[i]);
	sort(a, a + 2*n);
	LL ans = 1LL * (a[2*n - 1] - a[n]) * (a[n - 1] - a[0]);
	for(int i = 1; i < n; i ++){
		ans = min(ans, 1LL * (a[i + n - 1] - a[i]) * (a[2*n - 1] - a[0]) );
	}
	printf("%I64d", ans);
	return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

const int maxn = 2e5 + 10;
typedef long long ll;

int n, a[maxn];

ll Solve() {
	int k = n >> 1, res = 0x3f3f3f3f;
	for (int i = 2, u = 2; i <= n - k; i++) {
		while (u < i + k) u++;
		res = min(res, a[u - 1] - a[i]);
	}
	return 1ll * res * (a[n] - a[1]);
}

int main() {
	scanf("%d", &n), n <<= 1;
	for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
	sort(a + 1, a + 1 + n);
	printf("%lld\n", min(1ll * (a[n >> 1] - a[1]) * (a[n] - a[(n >> 1) + 1]), Solve()));
	return 0;
}


#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <utility>
#include <cstdio>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#define my_abs(x) ((x) < 0 ? -(x) : (x))
#define mp std::make_pair
#define pb push_back
typedef long long ll;
int arr[200005];
std::map<int, int> app;
int main()
{
#ifndef ONLINE_JUDGE
	freopen("1012A.in", "r", stdin);
#endif
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n << 1; i++)
	{
		scanf("%d", arr + i);
		if (++app[arr[i]] >= n)
		{
			puts("0");
			return 0;
		}
	}
	std::sort(arr, arr + (n << 1));
	printf("%lld\n", (ll)(arr[n - 1] - arr[0]) * (arr[2 * n - 1] - arr[n]));
	return 0;
}


#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <utility>
#include <cstdio>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#define my_abs(x) ((x) < 0 ? -(x) : (x))
#define mp std::make_pair
#define pb push_back
typedef long long ll;
int arr[200005];
std::map<int, int> app;
int main()
{
#ifndef ONLINE_JUDGE
	freopen("1012A.in", "r", stdin);
#endif
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n << 1; i++)
		scanf("%d", arr + i);
	std::sort(arr, arr + (n << 1));
	ll ans = (ll)(arr[n - 1] - arr[0]) * (arr[2 * n - 1] - arr[n]);
	for (int i = 0; i <= n; i++)
		ans = std::min(ans, (ll)(arr[2 * n - 1] - arr[0]) * (arr[i + n - 1] - arr[i]));
	printf("%lld\n", ans);
	return 0;
}


#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <utility>
#include <cstdio>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#define my_abs(x) ((x) < 0 ? -(x) : (x))
#define mp std::make_pair
#define pb push_back
typedef long long ll;
int arr[200005];
int main()
{
#ifndef ONLINE_JUDGE
	freopen("1012A.in", "r", stdin);
#endif
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n << 1; i++)
		scanf("%d", arr + i);
	std::sort(arr, arr + (n << 1));
	printf("%lld\n", (ll)(arr[n - 1] - arr[0]) * (arr[2 * n - 1] - arr[n]));
	return 0;
}


#include <bits/stdc++.h>
#define LL long long
using namespace std;
const int maxn = 3e5 + 5;
int n, a[maxn], pos[maxn], b[maxn];
LL ans = 0;
inline int read(){
	char ch = getchar(); int u = 0, f = 1;
	while(!isdigit(ch)){if(ch == '-')f = -1; ch = getchar();}
	while(isdigit(ch)){u = u * 10 + ch - 48; ch = getchar();} return u * f;
}
int main(){
	n = read();
	for(register int i = 1; i <= n * 2; i++)
		pos[i] = a[i] = read();
	sort(a + 1, a + 1 + 2 * n);
	ans = 1ll * (a[n] - a[1]) * (a[2 * n] - a[n + 1]);
	for(register int i = 2; i <= n; i++)
		ans = min(ans, 1ll * (a[i + n - 1] - a[i]) * (a[2 * n] - a[1]));
	cout << ans;
	return 0; // same???
}


// luogu-judger-enable-o2
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<queue>
#include<cmath>
#include<cstring>
#include <ctime>
#define LL long long
#define ept 1e-10
#define pa pair<int,int>
using namespace std;
const int N=1000050;
const LL mod=1e9+7;
int n,m;
LL a[N];
int main(){
	scanf("%d",&n);m=n;n<<=1;
	for(int i=1;i<=n;++i)
		scanf("%I64d",&a[i]);
	sort(a+1,a+1+n);
	LL ans=(a[m]-a[1])*(a[n]-a[m+1]);
	for(int i=2;i+m-1<n;++i)
		ans=min(ans,(a[n]-a[1])*(a[i+m-1]-a[i]));
	printf("%I64d\n",ans);
	return 0;
}


#include<cstdio>
#include<algorithm>
#include<iostream>
#include<queue>
#include<cmath>
#include<cstring>
#include <ctime>
#define LL long long
#define ept 1e-10
#define pa pair<int,int>
using namespace std;
const int N=5e3+50;
const LL mod=1e9+7;
int n,m;
LL a[N];
int main(){
	scanf("%d",&n);m=n;n<<=1;
	for(int i=1;i<=n;++i)
		scanf("%I64d",&a[i]);
	sort(a+1,a+1+n);
	printf("%I64d\n",(a[m]-a[1])*(a[n]-a[m+1]));
	return 0;
}


// luogu-judger-enable-o2
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<queue>
#include<cmath>
#include<cstring>
#include <ctime>
#define LL long long
#define ept 1e-10
#define pa pair<int,int>
using namespace std;
const int N=1000050;
const LL mod=1e9+7;
int n,m;
LL a[N];
int main(){
	scanf("%d",&n);m=n;n<<=1;
	for(int i=1;i<=n;++i)
		scanf("%I64d",&a[i]);
	sort(a+1,a+1+n);
	printf("%I64d\n",(a[m]-a[1])*(a[n]-a[m+1]));
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=200005;
int n,a[N];
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=2*n;i++)scanf("%d",&a[i]);
	sort(a+1,a+2*n+1);
	ll ans=(1ll<<60);
	for (int i=1;i<=n;i++)
	 {
		int l1=(i==1?a[n+1]:a[1]);
		ans=min(ans,1ll*(a[i+n-1]-a[i])*(a[2*n]-l1));
	 }
	printf("%lld\n",ans);
}


#include<bits/stdc++.h>
#define forn(i,n) for(int i=0;i<(n);++i)
#define forab(i,a,b) for(int i=(a);i<(b);i++)
#define forba(i,b,a) for(int i=(b);i>(a);i--)
#define ll long long
#define mset(a,n) memset(a,n,sizeof(a))
#define eps 1e-12
#define endl '\n'
#define fast ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
using namespace std;
//luogu
const int maxn = 1e5+5;

int a[2*maxn];

int main()
{
	int n;
	fast;
	cin >> n;
	forn(i,2*n)cin >> a[i];
	if(n==1){
		cout << "0\n";return 0;
	}
	sort(a,a+2*n);
	int temp = 1<<30;
	for(int i = 1;i<n;i++){
		temp = min(temp,a[i+n-1]-a[i]);
	}
	ll ans;
	ans = (ll)(a[2*n-1]-a[n])*(a[n-1]-a[0]);
	ans = min(ans,(ll)temp*(a[2*n-1]-a[0]));
	cout << ans << endl;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int a[200005];
int main(){
	int n;
	scanf("%d",&n);
	for(int i=1;i<=2*n;i++)scanf("%d",&a[i]);
	sort(a+1,a+2*n+1);
	printf("%lld\n",1ll*(a[n]-a[1])*(a[2*n]-a[n+1]));
	return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int a[200005];
int main(){
	int n;
	scanf("%d",&n);
	for(int i=1;i<=2*n;i++)scanf("%d",&a[i]);
	sort(a+1,a+2*n+1);
	long long ans=1ll*(a[n]-a[1])*(a[2*n]-a[n+1]);
	for(int i=n+1;i<2*n;i++)ans=min(ans,1ll*(a[i]-a[i-n+1])*(a[2*n]-a[1]));
	printf("%lld\n",ans);
	return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
#define max 100005
#define maxn 200005
int a[maxn];

int min(int x, int y)
{
	if (x < y)
		return x;
	return y;
}

int main()
{
	int T;
	scanf("%d", &T);
	for (int i = 0; i < 2 * T; i++)
		scanf("%d", &a[i]);
	sort(a, a + 2 * T);
	long long x = a[T - 1]- a[0];
	long long y = a[2 * T - 1]- a[T];
	long long ans = x * y;
	long long ans1;
	for (int i = 1; i < T; i++)
	{
		ans1 = (a[2 * T - 1] - a[0])*(a[T-1 + i] - a[i]);
		ans = min(ans, ans1);
	}
	cout << ans << endl;

	return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
#define max 100005
#define maxn 200005
int a[maxn];

int min(int x, int y)
{
	if (x < y)
		return x;
	return y;
}

int main()
{
	int T;
	scanf("%d", &T);
	for (int i = 0; i < 2 * T; i++)
		scanf("%d", &a[i]);
	sort(a, a + 2 * T);
	long x = a[T - 1]- a[0];
	long y = a[2 * T - 1]- a[T];
	long ans = x * y;
	for (int i = 1; i < T; i++)
	{
		long long ans1;
		ans1 = (a[2 * T - 1] - a[0])*(a[T-1 + i] - a[i]);
		ans = min(ans, ans1);
	}
	printf("%d", ans);

	return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
#define max 100005
#define maxn 200005
long long a[maxn];

int min(int x, int y)
{
	if (x < y)
		return x;
	return y;
}

int main()
{
	int T;
	scanf("%d", &T);
	for (int i = 0; i < 2 * T; i++)
		cin >> a[i];
	sort(a, a + 2 * T);
	long long x = a[T - 1]- a[0];
	long long y = a[2 * T - 1]- a[T];
	long long ans = x * y;
	long long ans1;
	for (int i = 1; i < T; i++)
	{
		ans1 = (a[2 * T - 1] - a[0])*(a[T-1 + i] - a[i]);
		ans = min(ans, ans1);
	}
	cout << ans << endl;

	return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
#define max 100005
#define maxn 200005
int a[maxn];

int min(int x, int y)
{
	if (x < y)
		return x;
	return y;
}

int main()
{
	int T;
	scanf("%d", &T);
	for (int i = 0; i < 2 * T; i++)
		scanf("%d", &a[i]);
	sort(a, a + 2 * T);
	long x = a[T - 1]- a[0];
	long y = a[2 * T - 1]- a[T];
	long long ans = x * y;
	for (int i = 1; i < T; i++)
	{
		long long ans1;
		ans1 = (a[2 * T - 1] - a[0])*(a[T-1 + i] - a[i]);
		ans = min(ans, ans1);
	}
	printf("%d", ans);

	return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
#define max 100005
#define maxn 200005
int a[maxn];

int min(int x, int y)
{
	if (x < y)
		return x;
	return y;
}

int main()
{
	int T;
	scanf("%d", &T);
	for (int i = 0; i < 2 * T; i++)
		scanf("%d", &a[i]);
	sort(a, a + 2 * T);
	long long x = a[T - 1]- a[0];
	long long y = a[2 * T - 1]- a[T];
	long long ans = x * y;
	for (int i = 1; i < T; i++)
	{
		long long ans1;
		ans1 = (a[2 * T - 1] - a[0])*(a[T-1 + i] - a[i]);
		ans = min(ans, ans1);
	}
	cout << ans << endl;

	return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
#define max 100005
#define maxn 200005
int a[maxn];

int min(int x, int y)
{
	if (x < y)
		return x;
	return y;
}

int main()
{
	int T;
	scanf_s("%d", &T);
	for (int i = 0; i < 2 * T; i++)
		scanf_s("%d", &a[i]);
	sort(a, a + 2 * T);
	long x = a[T - 1]- a[0];
	long y = a[2 * T - 1]- a[T];
	long ans = x * y;
	for (int i = 1; i < T; i++)
	{
		long long ans1;
		ans1 = (a[2 * T - 1] - a[0])*(a[T-1 + i] - a[i]);
		ans = min(ans, ans1);
	}
	printf("%d", ans);
	system("pause");

	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define maxn 100005
using namespace std;
int a[maxn*2];
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=0;i<2*n;i++)
        scanf("%d",&a[i]);
    sort(a,a+2*n);

    int a1=a[0];
    int b1=a[n-1];
    int a2=a[n];
    int b2=a[2*n-1];

    long long ans=(b1-a1)*(b2-a2);
    printf("%lld\n",ans);
    return 0;
}


//给你一个长度为2n 的数组，将这个数组分为两个可重集，每个集合有n 个元素，使得这两个集合的极差之积最小，输出这个最小值
//https://www.luogu.org/problemnew/solution/CF1012A
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define maxn 100005
using namespace std;
int a[maxn*2];
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=0;i<2*n;i++)
        scanf("%d",&a[i]);
    sort(a,a+2*n);
    long long ans = (a[n-1]-a[0])*(a[2*n-1]-a[n]);

    long long xx=a[2*n-1]-a[0];
    long long minx = ans;
    for(int i=1;i<n;i++)
    {
        //printf("%d %d\n",i,i+n-1);
        minx=min(minx,1ll*(a[i+n-1]-a[i])*xx);
    }
    printf("%lld\n",minx);
    return 0;
}