#include <bits/stdc++.h>
using namespace std;
int n;
set<pair<pair<int, int>, int> > seg;
vector<int> edges[100005];
int color[100005];
void dfs(int x, int j) {
  color[x] = j;
  for (int i = 0; i < edges[x].size(); ++i)
    if (color[edges[x][i]] == -1) dfs(edges[x][i], 1 - j);
}
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) {
    color[i] = -1;
    int l, r;
    cin >> l >> r;
    seg.insert(pair<pair<int, int>, int>(pair<int, int>(l, r), i));
  }
  while (seg.size() > 1) {
    pair<pair<int, int>, int> k = *seg.begin();
    set<pair<pair<int, int>, int> >::iterator it = seg.begin();
    ++it;
    pair<pair<int, int>, int> k1 = *it;
    if (k.first.second < k1.first.first) {
      seg.erase(k);
      continue;
    }
    edges[k.second].push_back(k1.second);
    edges[k1.second].push_back(k.second);
    if (k.first.second == k1.first.second) {
      seg.erase(k);
      seg.erase(k1);
      continue;
    }
    if (k.first.second > k1.first.second) {
      pair<pair<int, int>, int> t = pair<pair<int, int>, int>(
          pair<int, int>(k1.first.second + 1, k.first.second), k.second);
      seg.erase(k);
      seg.erase(k1);
      seg.insert(t);
      continue;
    }
    pair<pair<int, int>, int> t = pair<pair<int, int>, int>(
        pair<int, int>(k.first.second + 1, k1.first.second), k1.second);
    seg.erase(k);
    seg.erase(k1);
    seg.insert(t);
    continue;
  }
  for (int i = 0; i < n; ++i) {
    if (color[i] == -1) dfs(i, 0);
  }
  for (int i = 0; i < n; ++i) cout << color[i] << ' ';
  cout << endl;
}
