#include <bits/stdc++.h>
using namespace std;
int n, m, tot;
int l[1000005], r[1000005], d[1000005], vst[1000005], Ban[1000005],
    col[1000005], b[1000005];
struct sola {
  int next, to, id;
} w[2000005];
int cnt = 1, h[1000005];
void AddEdge(int x, int y, int z) {
  w[++cnt] = (sola){h[x], y, z};
  h[x] = cnt;
}
void dfs(int x) {
  vst[x] = 1;
  for (int i = h[x]; i; i = w[i].next)
    if (!Ban[i]) {
      col[w[i].id] = (i < (i ^ 1));
      Ban[i] = Ban[i ^ 1] = 1;
      dfs(w[i].to);
    }
}
int main() {
  scanf("%d", &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &l[i], &r[i]);
    b[2 * i - 1] = l[i];
    b[2 * i] = ++r[i];
  }
  sort(b + 1, b + 2 * m + 1);
  n = unique(b + 1, b + 2 * m + 1) - (b + 1);
  for (int i = 1; i <= m; i++) {
    l[i] = lower_bound(b + 1, b + n + 1, l[i]) - b;
    r[i] = lower_bound(b + 1, b + n + 1, r[i]) - b;
    AddEdge(l[i], r[i], i);
    AddEdge(r[i], l[i], i);
    d[l[i]]++, d[r[i]]++;
  }
  for (int i = 1, last = -1; i <= n; i++)
    if (d[i] % 2) {
      if (last != -1)
        AddEdge(last, i, 0), AddEdge(i, last, 0), last = -1;
      else
        last = i;
    }
  for (int i = 1; i <= n; i++)
    if (!vst[i]) dfs(i);
  for (int i = 1; i <= m; i++) printf("%d ", col[i]);
  return 0;
}
