#include <bits/stdc++.h>
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
using namespace std;
namespace ywy {
inline int get() {
  int n = 0;
  char c;
  while ((c = getchar()) || 23333) {
    if (c >= '0' && c <= '9') break;
    if (c == '-') goto s;
  }
  n = c - '0';
  while ((c = getchar()) || 23333) {
    if (c >= '0' && c <= '9')
      n = n * 10 + c - '0';
    else
      return (n);
  }
s:
  while ((c = getchar()) || 23333) {
    if (c >= '0' && c <= '9')
      n = n * 10 - c + '0';
    else
      return (n);
  }
}
typedef struct _b {
  int dest;
  int nxt;
  int id;
  unsigned char gg;
} bian;
bian memchi[1000001];
int gn = 2, heads[222222];
inline void add(int s, int t, int id) {
  memchi[gn].dest = t;
  memchi[gn].id = id;
  memchi[gn].nxt = heads[s];
  heads[s] = gn;
  gn++;
}
int dss[333333], dts[333333];
unsigned char bv[333333];
void dfs(int pt) {
  bv[pt] = 1;
  for (register int i = heads[pt]; i; heads[pt] = i = memchi[i].nxt) {
    if (memchi[i].gg) continue;
    dss[memchi[i].id] = pt;
    dts[memchi[i].id] = memchi[i].dest;
    memchi[i].gg = memchi[i ^ 1].gg = 1;
    dfs(memchi[i].dest);
  }
}
int lsh[222222];
int ls[100001], rs[100001], adds[222222], dels[222222], cnt[222222];
void ywymain() {
  int n = get();
  int ptr = 1;
  for (register int i = 1; i <= n; i++) {
    ls[i] = lsh[ptr] = get();
    ptr++;
    rs[i] = lsh[ptr] = get() + 1;
    ptr++;
  }
  ptr--;
  sort(lsh + 1, lsh + 1 + ptr);
  int newl = unique(lsh + 1, lsh + 1 + ptr) - lsh - 1;
  for (register int i = 1; i <= n; i++) {
    ls[i] = lower_bound(lsh + 1, lsh + 1 + newl, ls[i]) - lsh;
    rs[i] = lower_bound(lsh + 1, lsh + 1 + newl, rs[i]) - lsh;
    add(ls[i], rs[i], i);
    add(rs[i], ls[i], i);
    adds[ls[i]]++;
    dels[rs[i]]++;
  }
  for (register int i = 1; i <= newl; i++) {
    cnt[i] = cnt[i - 1] + adds[i] - dels[i];
    if (cnt[i] & 1) {
      add(i, i + 1, n + 1);
      add(i + 1, i, n + 1);
    }
  }
  for (register int i = 1; i <= newl; i++) {
    if (bv[i]) continue;
    dfs(i);
  }
  for (register int i = 1; i <= n; i++) {
    if (dss[i] > dts[i])
      printf("1 ");
    else
      printf("0 ");
  }
}
}  // namespace ywy
int main() {
  ywy::ywymain();
  return (0);
}
