#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x *= f;
}
int n, m, tot = 1, last;
int to[200005 << 1], num[200005 << 1], nxt[200005 << 1], head[200005];
int q[200005], d[200005], vis[200005], used[200005 << 1], ans[200005 >> 1];
struct Data {
  int l, r;
} t[200005 >> 1];
void add(int u, int v, int w) {
  to[++tot] = v;
  num[tot] = w;
  nxt[tot] = head[u];
  head[u] = tot;
}
void dfs(int x) {
  vis[x] = 1;
  for (int &i = head[x]; i; i = nxt[i])
    if (!used[i]) {
      used[i] = used[i ^ 1] = 1;
      ans[num[i]] = (to[i] > x);
      dfs(to[i]);
    }
}
int main() {
  n = read();
  for (int i = 1; i <= n; i++) {
    t[i].l = read();
    t[i].r = read() + 1;
    q[++m] = t[i].l;
    q[++m] = t[i].r;
  }
  sort(q + 1, q + m + 1);
  m = unique(q + 1, q + m + 1) - q - 1;
  for (int i = 1; i <= n; i++) {
    t[i].l = lower_bound(q + 1, q + m + 1, t[i].l) - q;
    t[i].r = lower_bound(q + 1, q + m + 1, t[i].r) - q;
    add(t[i].l, t[i].r, i);
    add(t[i].r, t[i].l, i);
    d[t[i].l]++;
    d[t[i].r]++;
  }
  for (int i = 1; i <= m; i++)
    if (d[i] & 1) {
      if (last) {
        add(last, i, 0);
        add(i, last, 0);
        d[last]++;
        d[i]++;
        last = 0;
      } else
        last = i;
    }
  for (int i = 1; i <= m; i++)
    if (!vis[i]) dfs(i);
  for (int i = 1; i <= n; i++) printf("%d ", ans[i]);
  return 0;
}
