#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int ans = 0, fh = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') fh = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') ans = ans * 10 + ch - '0', ch = getchar();
  return ans * fh;
}
const int maxn = 4e5;
int n, ql[maxn], qr[maxn], b[maxn], mx, du[maxn];
int head[maxn], nex[maxn], v[maxn], num = 1, vis[maxn], ans[maxn];
inline void lsh() {
  for (int i = 1; i <= n; i++) {
    b[++mx] = ql[i], b[++mx] = ql[i] - 1;
    b[++mx] = qr[i], b[++mx] = qr[i] + 1;
  }
  sort(b + 1, b + mx + 1), mx = unique(b + 1, b + mx + 1) - b - 1;
  for (int i = 1; i <= n; i++) {
    ql[i] = lower_bound(b + 1, b + mx + 1, ql[i]) - b;
    qr[i] = lower_bound(b + 1, b + mx + 1, qr[i]) - b;
  }
}
inline void add(int x, int y) {
  v[++num] = y, du[x]++;
  nex[num] = head[x], head[x] = num;
  v[++num] = x, du[y]++;
  nex[num] = head[y], head[y] = num;
}
void dfs(int x) {
  for (int &i = head[x]; i; i = nex[i]) {
    if (vis[i >> 1]) continue;
    int y = v[i];
    vis[i >> 1] = 1;
    du[x]--, du[y]--;
    ans[i >> 1] = y > x, dfs(y);
  }
}
int main() {
  n = read();
  for (int i = 1; i <= n; i++) ql[i] = read(), qr[i] = read();
  lsh();
  for (int i = 1; i <= n; i++) add(ql[i], qr[i] + 1);
  for (int i = 1, las = 0; i <= mx; i++)
    if (du[i] & 1) {
      if (!las)
        las = i;
      else
        add(las, i), las = 0;
    }
  for (int i = 1; i <= mx; i++)
    if (du[i]) dfs(i);
  for (int i = 1; i <= n; i++) printf("%d ", ans[i]);
  return 0;
}
