#include <bits/stdc++.h>
using namespace std;
int read() {
  char c = getchar();
  while (c < '0' || c > '9') c = getchar();
  int x = 0;
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x;
}
const int maxn = 1000002;
struct seg {
  int l, r, id;
  seg(int l = 0, int r = 0, int id = 0) : l(l), r(r), id(id) {}
  bool operator<(const seg& rhs) const {
    return l > rhs.l || l == rhs.l && r > rhs.r;
  }
} a[maxn];
priority_queue<seg> q;
int b[maxn], cur;
bool ans[maxn];
int t[maxn];
int n;
int fa[maxn];
int gf(int x) { return fa[x] == x ? x : fa[x] = gf(fa[x]); }
void lk(int x, int y) {
  fa[gf(x)] = gf(y + n);
  fa[gf(y)] = gf(x + n);
}
int main() {
  n = read();
  for (int i = 1; i <= n; i++) a[i].l = read(), a[i].r = read(), a[i].id = i;
  for (int i = 1; i <= n; i++) q.push(a[i]);
  for (int i = 1; i <= 2 * n; i++) fa[i] = i;
  while (q.size() > 1) {
    seg x = q.top();
    q.pop();
    seg y = q.top();
    q.pop();
    if (x.r < y.l) {
      q.push(y);
      continue;
    }
    lk(x.id, y.id);
    if (x.r == y.r) continue;
    if (x.r < y.r)
      q.push(seg(x.r + 1, y.r, y.id));
    else
      q.push(seg(y.r + 1, x.r, x.id));
  }
  memset(t, -1, sizeof(t));
  for (int i = 1; i <= n; i++) {
    if (t[gf(i)] != -1)
      ans[i] = !t[gf(i)], t[gf(i + n)] = !t[gf(i)];
    else {
      if (t[gf(i + n)] == -1) t[gf(i + n)] = 0;
      ans[i] = t[gf(i + n)], t[gf(i)] = !t[gf(i + n)];
    }
    printf("%d ", ans[i]);
  }
}
