#include <bits/stdc++.h>
using namespace std;
const int SIZE = 1e5 + 5;
const int IN = 1;
const int OUT = 0;
struct data {
  int id, x, io;
  data(int _id = 0, int _x = 0, int _io = 0) : id(_id), x(_x), io(_io) {}
  bool operator<(const data& b) const { return x < b.x; }
} a[SIZE * 2];
int m = 0;
int to[SIZE * 2], an[SIZE];
int main() {
  int(n);
  scanf("%d", &n);
  for (int i = 0; i < (n); ++i) {
    int l, r;
    scanf("%d%d", &l, &r);
    a[m++] = data(i, l, IN);
    a[m++] = data(i, r + 1, OUT);
  }
  sort(a, a + m);
  for (int i = 0; i < m; i++)
    to[a[i].id * 2 + a[i].io] = a[i ^ 1].id * 2 + a[i ^ 1].io;
  for (int i = 0; i < n; i++) {
    if (!an[i]) {
      int now = i;
      int me = IN;
      an[i] = 1;
      while (1) {
        int tmp = to[now * 2 + me];
        if (tmp / 2 == i) break;
        if ((tmp & 1) == me) {
          an[tmp >> 1] = -an[now];
        } else {
          an[tmp >> 1] = an[now];
        }
        now = tmp >> 1;
        me = tmp & 1;
        me ^= 1;
      }
    }
  }
  for (int i = 0; i < (n); ++i) {
    if (i) putchar(' ');
    if (an[i] == 1)
      printf("1");
    else
      printf("0");
  }
  puts("");
  return 0;
}
