#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 100;
const int M = 2e5 + 100;
int ll[N], rr[N];
int sta[N], top;
struct Edge {
  int v, next;
  Edge() {}
  Edge(int v, int next) : v(v), next(next) {}
} e[M * 2];
int head[N], total;
void init() {
  memset(head, -1, sizeof(head));
  total = 0;
}
void adde(int u, int v) {
  e[total] = Edge(v, head[u]);
  head[u] = total++;
}
int vis[M];
void dfs(int u) {
  while (head[u] != -1) {
    int id = head[u];
    head[u] = e[id].next;
    if (vis[id / 2]) continue;
    if (u == ll[id / 2])
      vis[id / 2] = 2;
    else
      vis[id / 2] = 1;
    dfs(ll[id / 2] + rr[id / 2] - u);
  }
}
int du[N];
void pri(int aa[N], int n) {
  for (int i = 0; i < n; i++) printf("%d ", aa[i]);
  printf("\n");
}
int main() {
  int n;
  while (scanf("%d", &n) != EOF) {
    top = 0;
    for (int i = 0; i < n; i++) {
      int l, r;
      scanf("%d%d", &l, &r);
      r++;
      ll[i] = l, rr[i] = r;
      sta[top++] = l;
      sta[top++] = r;
    }
    sort(sta, sta + top);
    top = unique(sta, sta + top) - sta;
    for (int i = 0; i < n; i++) {
      ll[i] = lower_bound(sta, sta + top, ll[i]) - sta;
      rr[i] = lower_bound(sta, sta + top, rr[i]) - sta;
    }
    init();
    memset(du, 0, sizeof(du));
    for (int i = 0; i < n; i++) {
      adde(ll[i], rr[i]);
      adde(rr[i], ll[i]);
      du[ll[i]]++;
      du[rr[i]]++;
    }
    int p = -1;
    int m = n;
    for (int i = 0; i < top; i++)
      if (du[i] % 2) {
        if (p == -1)
          p = i;
        else {
          adde(p, i);
          adde(i, p);
          ll[n] = p, rr[n] = i;
          n++;
          p = -1;
        }
      }
    memset(vis, 0, sizeof(vis));
    for (int i = 0; i < n; i++)
      if (!vis[i]) {
        dfs(ll[i]);
      }
    for (int i = 0; i < m; i++) {
      printf("%d%c", 2 - vis[i], i == m - 1 ? '\n' : ' ');
    }
  }
  return 0;
}
