#include <bits/stdc++.h>
using namespace std;
int n, t, tot, hd[200005], nxt[400005], to[400005], vis[200005], col[200005];
struct node {
  pair<int, int> p;
  int id;
} e[200005];
int read() {
  int x = 0, fl = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') fl = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 1) + (x << 3) + ch - '0';
    ch = getchar();
  }
  return x * fl;
}
bool operator<(const node &a, const node &b) { return a.p < b.p; }
void add(int x, int y) {
  tot++;
  to[tot] = y;
  nxt[tot] = hd[x];
  hd[x] = tot;
  return;
}
void dfs(int x, int c) {
  vis[x] = 1, col[x] = c;
  for (int i = hd[x]; i; i = nxt[i]) {
    int y = to[i];
    if (vis[y]) continue;
    dfs(y, 3 - c);
  }
  return;
}
int main() {
  n = read();
  for (int i = 1; i <= n; i++) {
    int x = read(), y = read();
    t++;
    e[t] = {{x, -1}, i};
    t++;
    e[t] = {{y, 1}, i + n};
    add(i, n + i), add(n + i, i);
  }
  sort(e + 1, e + t + 1);
  for (int i = 1; i <= t; i += 2) {
    add(e[i].id, e[i + 1].id);
    add(e[i + 1].id, e[i].id);
  }
  for (int i = 1; i <= t; i++)
    if (!vis[i]) dfs(i, 1);
  for (int i = 1; i <= n; i++) printf("%d ", col[i] - 1);
  return 0;
}
