#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int N, L[maxn], R[maxn], X[maxn * 2],
    m(1), a[maxn * 4], b[maxn * 4], c[maxn * 4], d[maxn * 4], dgr[maxn * 2];
bool ans[maxn], flag[maxn * 2], disused[maxn * 4];
inline void Add(int x, int y, int z) {
  m++, b[m] = y, c[m] = a[x], a[x] = m, d[m] = z;
  m++, b[m] = x, c[m] = a[y], a[y] = m, d[m] = z;
  dgr[x]++, dgr[y]++;
}
int Dfs(int x, int last = 0) {
  for (int i = a[x]; i; i = c[i])
    if (!disused[i]) {
      disused[i] = disused[i ^ 1] = true;
      ans[d[i]] = (b[i] > x);
      dgr[x]--, dgr[b[i]]--;
      int got;
      if (!flag[b[i]]) {
        flag[b[i]] = true;
        got = Dfs(b[i], x);
        flag[b[i]] = false;
      } else
        got = b[i];
      if (got && got != x) return got;
    }
  return 0;
}
int main() {
  scanf("%d", &N);
  int n(0);
  for (int i = 1; i <= N; i++) {
    scanf("%d%d", &L[i], &R[i]);
    L[i] *= 2, R[i] *= 2, R[i]++;
    X[++n] = L[i], X[++n] = R[i];
  }
  sort(X + 1, X + n + 1);
  n = unique(X + 1, X + n + 1) - X - 1;
  for (int i = 1; i <= N; i++)
    Add(lower_bound(X + 1, X + n + 1, L[i]) - X,
        lower_bound(X + 1, X + n + 1, R[i]) - X, i);
  int last(0);
  for (int i = 1; i <= N * 2 + 1; i++)
    if (dgr[i] & 1)
      if (!last)
        last = i;
      else
        Add(last, i, 0), last = 0;
  for (int i = 1; i <= N * 2 + 1; i++)
    while (dgr[i]) {
      flag[i] = true;
      Dfs(i);
    }
  for (int i = 1; i < N; i++) printf("%d ", int(ans[i]));
  printf("%d\n", int(ans[N]));
  return 0;
}
