#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200005;
vector<int> Lk[MAXN];
bool Use[MAXN], Col[MAXN];
int P[MAXN], Ord[MAXN], N, M;
void Link(int x, int y) { Lk[x].push_back(y); }
bool cmp(int a, int b) { return P[a] < P[b]; }
void Dfs(int Now, int C) {
  Col[Now] = C;
  Use[Now] = 1;
  for (vector<int>::iterator it = Lk[Now].begin(); it != Lk[Now].end(); it++)
    if (!Use[*it]) Dfs(*it, C ^ 1);
}
int main() {
  scanf("%d", &N);
  for (int i = 1; i <= N; i++) {
    scanf("%d%d", &P[i], &P[i + N]);
    P[i + N]++;
    Link(i, i + N), Link(i + N, i);
  }
  for (int i = 1; i <= 2 * N; i++) Ord[i] = i;
  sort(Ord + 1, Ord + 2 * N + 1, cmp);
  for (int i = 1; i <= 2 * N; i += 2)
    Link(Ord[i], Ord[i + 1]), Link(Ord[i + 1], Ord[i]);
  for (int i = 1; i <= 2 * N; i++)
    if (!Use[i]) Dfs(i, 0);
  for (int i = 1; i <= N; i++) printf("%d%c", Col[i], i == N ? '\n' : ' ');
  return 0;
}
