#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> points(n, 0);
  map<int, int> hmap;
  vector<pair<int, int> > seg;
  for (int i = 0; i <= n - 1; i++) cin >> points[i];
  vector<int> pts((points).begin(), (points).end());
  for (int i = 0; i <= m - 1; i++) {
    int a, b;
    cin >> a >> b;
    seg.push_back(make_pair(a, b));
  }
  sort((pts).begin(), (pts).end());
  for (int i = 0; i <= n - 1; i++) {
    int t;
    if (i % 2 == 0)
      t = 0;
    else
      t = 1;
    hmap.insert(make_pair(pts[i], t));
  }
  for (int i = 0; i <= n - 1; i++) {
    cout << hmap[points[i]] << " ";
  }
  return 0;
}
