#include <bits/stdc++.h>
using namespace std;
const int maxn = 200005;
inline int gi() {
  char c = getchar();
  while (c < '0' || c > '9') c = getchar();
  int sum = 0;
  while ('0' <= c && c <= '9') sum = sum * 10 + c - 48, c = getchar();
  return sum;
}
int n, l[maxn], r[maxn], ans[maxn], *q[maxn], num, cnt;
struct edge {
  int to, next, Id;
} e[maxn * 2];
int h[maxn], vis[maxn], deg[maxn], tot = 1;
inline void add(int u, int v, int Id) {
  e[++tot] = (edge){v, h[u], Id};
  h[u] = tot;
  e[++tot] = (edge){u, h[v], Id};
  h[v] = tot;
}
void dfs(int u) {
  for (int &i = h[u]; i; i = e[i].next)
    if (!vis[i >> 1]) vis[i >> 1] = 1, ans[e[i].Id] = i & 1, dfs(e[i].to);
}
int main() {
  n = gi();
  for (int i = 1; i <= n; ++i)
    l[i] = gi(), r[i] = gi() + 1, q[++cnt] = &l[i], q[++cnt] = &r[i];
  sort(q + 1, q + cnt + 1, [](int *a, int *b) { return *a < *b; });
  num = 0;
  for (int k = -1, i = 1; i <= cnt; ++i)
    if (*q[i] == k)
      *q[i] = num;
    else
      k = *q[i], *q[i] = ++num;
  for (int i = 1; i <= n; ++i)
    deg[l[i]] ^= 1, deg[r[i]] ^= 1, add(l[i], r[i], i);
  for (int i = 1; i <= num; ++i) {
    deg[i] ^= deg[i - 1];
    if (deg[i] == 1) add(i, i + 1, 0);
  }
  for (int i = 1; i <= num; ++i)
    if (h[i]) dfs(i);
  for (int i = 1; i <= n; ++i) printf("%d ", ans[i]);
  return 0;
}
