#include <bits/stdc++.h>
using namespace std;
struct sweep {
  pair<int, int> P;
  int idx;
};
int N, L;
sweep B[2 * 100005];
vector<int> G[2 * 100005];
int color[2 * 100005];
bool qx(sweep a, sweep b) { return a.P < b.P; }
void doIt(int node) {
  for (auto it : G[node])
    if (!color[it]) color[it] = -1 * color[node], doIt(it);
}
int main() {
  cin >> N;
  for (int i = 1; i <= N; i++) {
    int l, r;
    cin >> l >> r;
    L++;
    B[L] = {{l, -1}, i};
    L++;
    B[L] = {{r, 1}, N + i};
    G[i].push_back(N + i);
    G[N + i].push_back(i);
  }
  sort(B + 1, B + L + 1, qx);
  for (int i = 1; i < L; i += 2)
    G[B[i].idx].push_back(B[i + 1].idx), G[B[i + 1].idx].push_back(B[i].idx);
  for (int i = 1; i <= L; i++)
    if (!color[i]) {
      color[i] = 1;
      doIt(i);
    }
  for (int i = 1; i <= N; i++) cout << max(0, color[i]) << " ";
  return 0;
}
