#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
struct node {
  int to, nxt, val, book;
} edge[N * 4];
int head[N * 2], gcnt, ans[N * 2], L[N], R[N], n, m, table[N * 2], sum[N * 2];
void add(int x, int y, int z) {
  edge[++gcnt] = (node){y, head[x], z, 0}, head[x] = gcnt;
}
void ff(int x) {
  int i, y;
  for (i = head[x]; i != -1; i = head[x]) {
    y = edge[i].to;
    head[x] = edge[i].nxt;
    if (edge[i].book) continue;
    ans[i / 2 + 1] = edge[i].val;
    edge[i ^ 1].book = 1;
    ff(y);
  }
}
int main() {
  memset(head, -1, sizeof(head)), gcnt = -1;
  int i, j;
  scanf("%d", &n);
  for (i = 1; i <= n; i++)
    scanf("%d%d", &L[i], &R[i]), R[i]++, table[++m] = L[i], table[++m] = R[i];
  sort(table + 1, table + m + 1);
  m = unique(table + 1, table + m + 1) - table;
  for (i = 1; i <= n; i++)
    L[i] = lower_bound(table + 1, table + m + 1, L[i]) - table,
    R[i] = lower_bound(table + 1, table + m + 1, R[i]) - table,
    add(L[i], R[i], 0), add(R[i], L[i], 1), sum[L[i]]++, sum[R[i]]--;
  for (i = 1; i <= m; i++) {
    sum[i] += sum[i - 1];
    if (sum[i] % 2) add(i, i + 1, 0), add(i + 1, i, 1);
  }
  for (i = 1; i <= m; i++) ff(i);
  for (i = 1; i <= n; i++) printf("%d ", ans[i]);
  return ~~(0 - 0);
}
