#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  int n, m;
  cin >> n >> m;
  vector<pair<int, int> > x;
  vector<int> x1;
  long long v1, v2;
  map<int, int> ma;
  for (int i = 0; i < n; ++i) {
    cin >> v1;
    x.push_back(make_pair(v1, i));
    x1.push_back(v1);
  }
  vector<pair<int, int> > v;
  for (int i = 0; i < m; ++i) {
    cin >> v1 >> v2;
    v.push_back(make_pair(v1, v2));
  }
  sort(x.begin(), x.end());
  sort(v.begin(), v.end());
  int c = 1, j = 0;
  for (int i = 0; i < n; ++i) {
    ma[x[i].first] = c;
    c = 1 - c;
  }
  for (int i = 0; i < n; ++i) {
    cout << ma[x1[i]] << " ";
  }
}
