#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int n, l[N], r[N], B[N], cc, head[N], cnt, du[N];
int f[N], ans[N], top, vis[N], ed;
map<int, int> Map;
struct edge {
  int next, to, id;
} a[N << 2];
void link(int x, int y, int id) {
  a[++cnt] = (edge){head[x], y, id};
  du[y]++;
  head[x] = cnt;
}
void dfs(int x) {
  for (int &i = head[x], nw; i; i = a[i].next)
    if (!vis[abs(a[i].id)])
      vis[abs(a[i].id)] = 1, nw = a[i].id, dfs(a[i].to), ans[++top] = nw;
}
int main() {
  cin >> n;
  ed = n;
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &l[i], &r[i]);
    l[i]--;
    B[++cc] = l[i];
    B[++cc] = r[i];
  }
  sort(B + 1, B + cc + 1);
  cc = unique(B + 1, B + cc + 1) - B - 1;
  for (int i = 1; i <= cc; i++) Map[B[i]] = i;
  for (int i = 1; i <= n; i++) l[i] = Map[l[i]], r[i] = Map[r[i]];
  for (int i = 1; i <= n; i++) link(l[i], r[i], i), link(r[i], l[i], -i);
  for (int i = 1, lst = 0; i <= cc; i++)
    if (du[i] & 1) {
      if (lst)
        link(lst, i, ++ed), link(i, lst, -ed), lst = 0;
      else
        lst = i;
    }
  for (int i = 1; i <= cc; i++) dfs(i);
  for (int i = top; i >= 1; i--)
    if (abs(ans[i]) <= n) f[abs(ans[i])] = ans[i] > 0;
  for (int i = 1; i <= n; i++) printf("%d ", f[i]);
}
