#include <bits/stdc++.h>
using namespace std;
bool solve(vector<long long> a) {
  long long n = a.size();
  vector<long long> left(n);
  vector<long long> right(n);
  left[0] = a[0];
  for (long long i = 1; i < a.size(); i++) {
    left[i] = a[i] + left[i - 1];
  }
  right[n - 1] = a[a.size() - 1];
  for (long long i = n - 2; i >= 0; i--) {
    right[i] = right[i + 1] + a[i];
  }
  for (long long i = 0; i < n - 1; i++) {
    if (left[i] == right[i + 1]) return true;
  }
  return false;
}
bool cmp(pair<long long, long long> a, pair<long long, long long> b) {
  if (a.first < b.first) return true;
  if (a.first == b.first) {
    if (a.second < b.second) return true;
  }
  return false;
}
int32_t main() {
  long long t = 1;
  while (t--) {
    long long n, m1;
    cin >> n >> m1;
    vector<long long> a;
    map<long long, long long> m;
    for (long long i = 0; i < n; i++) {
      long long temp;
      cin >> temp;
      a.push_back(temp);
      m[temp] = i;
    }
    vector<pair<long long, long long> > seg;
    for (long long i = 0; i < m1; i++) {
      long long x, y;
      cin >> x >> y;
      seg.push_back({x, y});
    }
    sort(seg.begin(), seg.end(), cmp);
    vector<long long> color;
    long long flag = 0;
    for (auto i : m) {
      if (flag)
        a[i.second] = 1;
      else
        a[i.second] = 0;
      flag = 1 - flag;
    }
    for (auto i : a) cout << i << " ";
    cout << endl;
  }
}
