#include <bits/stdc++.h>
using namespace std;
vector<pair<int, pair<int, int> > > v;
vector<pair<int, int> > e[100005];
int n, c[100005];
void dfs(int v, int n) {
  c[v] = n;
  for (int i = 0; i < e[v].size(); i++) {
    if (c[e[v][i].first] == -1) {
      dfs(e[v][i].first, (n ^ e[v][i].second));
    }
  }
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    v.push_back(make_pair(a, make_pair(0, i)));
    v.push_back(make_pair(b, make_pair(1, i)));
  }
  sort(v.begin(), v.end());
  for (int i = 0; i < 2 * n; i += 2) {
    int x = (v[i].second.first == v[i + 1].second.first);
    e[v[i].second.second].push_back(make_pair(v[i + 1].second.second, x));
    e[v[i + 1].second.second].push_back(make_pair(v[i].second.second, x));
  }
  memset(c, -1, sizeof(c));
  for (int i = 0; i < n; i++) {
    if (c[i] != -1) continue;
    dfs(i, 0);
  }
  for (int i = 0; i < n; i++) printf("%d ", c[i]);
  puts("");
}
