#include <bits/stdc++.h>
using namespace std;
namespace SHENZHEBEI {
static const int GYN = 2333333;
char SZB[GYN], *SS = SZB, *TT = SZB;
inline char gc() {
  if (SS == TT) {
    TT = (SS = SZB) + fread(SZB, 1, GYN, stdin);
    if (SS == TT) return '\n';
  }
  return *SS++;
}
inline long long read() {
  long long x = 0, g = 1;
  char ch = gc();
  for (; !isdigit(ch); ch = gc())
    if (ch == '-') g = -1;
  for (; isdigit(ch); ch = gc()) x = x * 10 - 48 + ch;
  return x * g;
}
inline void write(long long x) {
  if (x < 0) putchar('-'), x = -x;
  if (x >= 10) write(x / 10);
  putchar(x % 10 + '0');
}
inline char readchar() {
  char ch = gc();
  for (; isspace(ch); ch = gc())
    ;
  return ch;
}
inline long long readstr(char *s) {
  char ch = gc();
  int cur = 0;
  for (; isspace(ch); ch = gc())
    ;
  for (; !isspace(ch); ch = gc()) s[cur++] = ch;
  s[cur] = '\0';
  return cur;
}
void Print(long long *a, int s, int t) {
  for (int i = (long long)(s); i <= (long long)(t); ++i) printf("%lld ", a[i]);
}
void Print(int *a, int s, int t) {
  for (int i = (long long)(s); i <= (long long)(t); ++i) printf("%d ", a[i]);
}
void Print(char *a, int s, int t) {
  for (int i = (long long)(s); i <= (long long)(t); ++i) putchar(a[i]);
}
void writeln(long long x) {
  write(x);
  puts("");
}
void Min(long long &x, long long y) { x = x < y ? x : y; }
void Max(long long &x, long long y) { x = x > y ? x : y; }
}  // namespace SHENZHEBEI
using namespace SHENZHEBEI;
const long long N = 200010;
vector<long long> g[N], w[N];
long long visted[N], dfn[N], a[N], b[N], q[N], vis[N], n, top;
void dfs(long long x) {
  visted[x] = 1;
  for (int i = (long long)(0); i < (long long)(g[x].size()); ++i) {
    if (vis[abs(w[x][i])]) continue;
    vis[abs(w[x][i])] = w[x][i] < 0 ? 1 : 2;
    dfs(g[x][i]);
  }
}
int main() {
  n = read();
  for (int i = (long long)(1); i <= (long long)(n); ++i) {
    a[i] = read(), b[i] = read() + 1;
    q[++top] = a[i], q[++top] = b[i];
  }
  sort(q + 1, q + top + 1);
  top = unique(q + 1, q + top + 1) - q - 1;
  for (int i = (long long)(1); i <= (long long)(n); ++i) {
    a[i] = lower_bound(q + 1, q + top + 1, a[i]) - q,
    b[i] = lower_bound(q + 1, q + top + 1, b[i]) - q;
    g[a[i]].push_back(b[i]);
    g[b[i]].push_back(a[i]);
    w[a[i]].push_back(i);
    w[b[i]].push_back(-i);
    ++dfn[a[i]];
    ++dfn[b[i]];
  }
  long long cnt = n;
  for (int i = (long long)(1); i <= (long long)(top); ++i) {
    dfn[i] += dfn[i - 1];
    if (dfn[i] & 1) {
      g[i].push_back(i + 1);
      g[i + 1].push_back(i);
      w[i].push_back(++cnt);
      w[i + 1].push_back(cnt);
    }
  }
  for (int i = (long long)(1); i <= (long long)(top); ++i)
    if (!visted[i]) dfs(i);
  for (int i = (long long)(1); i <= (long long)(n); ++i)
    write(vis[i] - 1), putchar(' ');
}
