#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:640000000")
using namespace std;
const double eps = 1e-9;
const double pi = acos(-1.0);
const int maxn = (int)2e5 + 10;
int l[maxn], r[maxn], x[maxn];
bool used[maxn], edge[maxn];
int col[maxn];
vector<pair<int, int> > g[maxn];
void dfs(int v) {
  for (int i = 0; i < (int)(g[v]).size(); i++) {
    int to = g[v][i].first;
    int id = g[v][i].second;
    if (edge[id]) continue;
    edge[id] = true;
    col[id] = v < to;
    dfs(to);
  }
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &l[i], &r[i]);
    r[i]++;
    x[2 * i] = l[i];
    x[2 * i + 1] = r[i];
  }
  sort(x, x + 2 * n);
  int m = unique(x, x + 2 * n) - x;
  for (int i = 0; i < n; i++) {
    int L = lower_bound(x, x + m, l[i]) - x;
    int R = lower_bound(x, x + m, r[i]) - x;
    g[L].push_back(make_pair(R, i));
    g[R].push_back(make_pair(L, i));
  }
  int prev = -1;
  int last = n;
  for (int i = 0; i < m; i++) {
    if ((int)(g[i]).size() % 2 == 1) {
      if (prev == -1) {
        prev = i;
      } else {
        g[prev].push_back(make_pair(i, last));
        g[i].push_back(make_pair(prev, last));
        last++;
        prev = -1;
      }
    }
  }
  for (int i = 0; i < m; i++) {
    dfs(i);
  }
  for (int i = 0; i < n; i++) {
    printf("%d ", col[i]);
  }
  return 0;
}
