#include <bits/stdc++.h>
using namespace std;
const int N = 400005;
template <class T>
void read(T &x) {
  bool f = 0;
  x = 0;
  char s = getchar();
  while (s > '9' || s < '0') {
    f |= (s == '-');
    s = getchar();
  }
  while (s >= '0' && s <= '9') {
    x = (x << 1) + (x << 3) + (s ^ 48);
    s = getchar();
  }
  x = f ? -x : x;
}
int n, cnt, du[N], col[N], a[N];
int ver[N], nxt[N], num[N], head[N], tot;
bool vis[N];
struct Edge {
  int x, id, flag;
} edge[N];
struct node {
  int x, y;
} seg[N];
bool cmp(Edge a, Edge b) { return a.x < b.x; }
void addedge(int x, int y, int z) {
  ver[++tot] = y, num[tot] = z, nxt[tot] = head[x], head[x] = tot;
}
void dfs(int x) {
  vis[x] = 1;
  for (int i = head[x]; i; i = nxt[i])
    if (a[num[i]] == 0) {
      int y = ver[i];
      if (num[i] <= n && x < y) col[num[i]] = 1;
      a[num[i]] = 1, dfs(y);
    }
}
int main() {
  read(n);
  for (int i = 1; i <= n; ++i) {
    read(edge[++cnt].x), edge[cnt].id = i, edge[cnt].flag = 0;
    read(edge[++cnt].x), edge[cnt].id = i, edge[cnt].flag = 1, ++edge[cnt].x;
  }
  sort(edge + 1, edge + cnt + 1, cmp), edge[0].x = -1 << 30;
  int cntt = 0;
  for (int i = 1; i <= cnt; ++i) {
    if (edge[i].x > edge[i - 1].x) ++cntt;
    if (edge[i].flag)
      seg[edge[i].id].y = cntt;
    else
      seg[edge[i].id].x = cntt;
  }
  for (int i = 1; i <= n; ++i) {
    addedge(seg[i].x, seg[i].y, i), addedge(seg[i].y, seg[i].x, i);
    du[seg[i].x]++, du[seg[i].y]++;
  }
  int last = 0;
  for (int i = 1, j = n; i <= cntt; ++i)
    if (du[i] & 1) {
      if (last)
        addedge(last, i, ++j), addedge(i, last, j), last = 0;
      else
        last = i;
    }
  for (int i = 1; i <= cntt; ++i)
    if (vis[i] == 0) dfs(i);
  for (int i = 1; i <= n; ++i) printf("%d ", col[i]);
  return 0;
}
