#include <bits/stdc++.h>
using namespace std;
inline void read(int& x) {
  char c11 = getchar();
  x = 0;
  while (!isdigit(c11)) c11 = getchar();
  while (isdigit(c11)) x = x * 10 + c11 - '0', c11 = getchar();
}
const int N = 201000;
struct Edge {
  int v, id, nxt;
} a[N + N];
int head[N], srt[N], L[N], R[N];
int deg[N], Ans[N];
bool vs[N], stop[N + N];
int n, _ = 1;
inline void add(int u, int v, int i) {
  a[++_].v = v, a[_].id = i, a[_].nxt = head[u], head[u] = _, ++deg[u];
  a[++_].v = u, a[_].id = i, a[_].nxt = head[v], head[v] = _, ++deg[v];
}
void dfs(int x) {
  vs[x] = true;
  for (int& i = head[x]; i; i = a[i].nxt)
    if (!stop[i]) {
      stop[i] = stop[i ^ 1] = true;
      Ans[a[i].id] = x < a[i].v;
      dfs(a[i].v);
    }
}
int main() {
  read(n);
  for (int i = 1; i <= n; ++i) {
    read(L[i]), srt[i + i - 1] = (L[i] = L[i] << 1);
    read(R[i]), srt[i + i] = (R[i] = R[i] << 1 | 1);
  }
  sort(srt + 1, srt + n + n + 1);
  int nn = unique(srt + 1, srt + n + n + 1) - srt - 1;
  for (int i = 1, l, r; i <= n; ++i) {
    l = lower_bound(srt + 1, srt + nn + 1, L[i]) - srt;
    r = lower_bound(srt + 1, srt + nn + 1, R[i]) - srt;
    add(l, r, i);
  }
  for (int i = 1, ls = 0; i <= nn; ++i)
    if (deg[i] & 1)
      if (ls)
        add(ls, i, 0), ls = 0;
      else
        ls = i;
  for (int i = 1; i <= nn; ++i)
    if (!vs[i]) dfs(i);
  for (int i = 1; i <= n; ++i) printf("%d ", Ans[i]);
  putchar(10);
  return 0;
}
