#include <bits/stdc++.h>
using namespace std;
namespace io {
const int SIZE = (1 << 21) + 1;
char ibuf[SIZE], *iS, *iT, obuf[SIZE], *oS = obuf, *oT = oS + SIZE - 1, c,
                                       qu[55];
int f, qr;
inline void flush() {
  fwrite(obuf, 1, oS - obuf, stdout);
  oS = obuf;
}
inline void putc(char x) {
  *oS++ = x;
  if (oS == oT) flush();
}
template <class I>
inline void gi(I &x) {
  for (f = 1, c = (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, SIZE, stdin),
                              (iS == iT ? EOF : *iS++))
                            : *iS++);
       c < '0' || c > '9';
       c = (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, SIZE, stdin),
                       (iS == iT ? EOF : *iS++))
                     : *iS++))
    if (c == '-') f = -1;
  for (x = 0; c <= '9' && c >= '0';
       c = (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, SIZE, stdin),
                       (iS == iT ? EOF : *iS++))
                     : *iS++))
    x = (x << 1) + (x << 3) + (c & 15);
  x *= f;
}
template <class I>
inline void get(I &x) {
  for (c = (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, SIZE, stdin),
                       (iS == iT ? EOF : *iS++))
                     : *iS++);
       c < 'A' || c > 'Z';
       c = (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, SIZE, stdin),
                       (iS == iT ? EOF : *iS++))
                     : *iS++))
    ;
  x = c;
}
inline void read(char *s) {
  for (c = (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, SIZE, stdin),
                       (iS == iT ? EOF : *iS++))
                     : *iS++);
       c < 'A' || c > 'Z';
       c = (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, SIZE, stdin),
                       (iS == iT ? EOF : *iS++))
                     : *iS++))
    ;
  for (; c >= 'A' && c <= 'Z';
       c = (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, SIZE, stdin),
                       (iS == iT ? EOF : *iS++))
                     : *iS++))
    *++s = c;
  *++s = '\0';
}
template <class I>
inline void print(I x) {
  if (!x) putc('0');
  if (x < 0) putc('-'), x = -x;
  while (x) qu[++qr] = x % 10 + '0', x /= 10;
  while (qr) putc(qu[qr--]);
}
struct Flusher_ {
  ~Flusher_() { flush(); }
} io_flusher_;
}  // namespace io
using io ::get;
using io ::gi;
using io ::print;
using io ::putc;
using io ::read;
const int N = 1e5 + 5, M = N * 6;
int pl[N], pr[N], a[N << 1], cnt[N << 1];
int tot = 1, head[M], nxt[M], adj[M], vis[M], col[M];
inline void addedge(register int x, register int y) {
  nxt[++tot] = head[x];
  adj[head[x] = tot] = y;
}
inline void dfs(register int x) {
  register int i;
  while (i = head[x])
    if (!vis[i])
      vis[i] = vis[i ^ 1] = 1, dfs(adj[i]), col[i / 2] = i & 1;
    else
      head[x] = nxt[i];
}
int main() {
  register int n, m, i;
  gi(n);
  m = 0;
  for (i = 1; i <= n; ++i)
    gi(pl[i]), gi(pr[i]), ++pr[i], a[++m] = pl[i], a[++m] = pr[i];
  sort(a + 1, a + 1 + m);
  m = unique(a + 1, a + 1 + m) - a - 1;
  for (i = 1; i <= n; ++i)
    pl[i] = lower_bound(a + 1, a + 1 + m, pl[i]) - a,
    pr[i] = lower_bound(a + 1, a + 1 + m, pr[i]) - a, addedge(pl[i], pr[i]),
    addedge(pr[i], pl[i]), ++cnt[pl[i]], --cnt[pr[i]];
  for (i = 1; i <= m; ++i) {
    cnt[i] += cnt[i - 1];
    if (cnt[i] & 1) addedge(i, i + 1), addedge(i + 1, i);
  }
  for (i = 1; i <= m; ++i) dfs(i);
  for (i = 1; i <= n; ++i) putc(col[i] ? '0' : '1'), putc(' ');
  putc('\n');
  return 0;
}
