#include <bits/stdc++.h>
using namespace std;
int n, m, x[105], tmp[105], c = 1, ans[105];
pair<int, int> seg[105];
bool sorts(pair<int, int> a, pair<int, int> b) { return a.first < b.first; }
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> x[i];
  for (int i = 0; i < n; i++) {
    tmp[i] = x[i];
    ans[x[i]] = -1;
  }
  for (int i = 0; i < m; i++) cin >> seg[i].first >> seg[i].second;
  sort(tmp, tmp + n);
  sort(seg, seg + m, sorts);
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < n; j++) {
      if (tmp[j] >= seg[i].first && tmp[j] <= seg[i].second) {
        if (ans[tmp[j]] < 0) {
          ans[tmp[j]] = c;
          c = 1 - c;
        }
      }
    }
  }
  for (int i = 0; i < n; i++)
    if (ans[x[i]] < 0) ans[x[i]] = 0;
  for (int i = 0; i < n; i++) cout << ans[x[i]] << " ";
  return 0;
}
