#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 7;
vector<int> g[N];
int col[N], u[N], v[N], mark[N], vis[N];
void dfs(int x, int y) {
  if (y != -1) vis[y] = true;
  mark[x] = true;
  for (auto i : g[x])
    if (!vis[i]) dfs(u[i] ^ v[i] ^ x, i);
  if (y != -1) {
    int o = u[y] ^ v[y] ^ x;
    if (o < x)
      col[y] = 1;
    else
      col[y] = 0;
  }
}
int32_t main() {
  int n;
  cin >> n;
  vector<int> comp;
  for (int i = 0; i < n; i++) {
    cin >> u[i] >> v[i];
    v[i]++;
    comp.push_back(u[i]);
    comp.push_back(v[i]);
  }
  sort(comp.begin(), comp.end());
  comp.resize(unique(comp.begin(), comp.end()) - comp.begin());
  for (int i = 0; i < n; i++) {
    u[i] = lower_bound(comp.begin(), comp.end(), u[i]) - comp.begin();
    v[i] = lower_bound(comp.begin(), comp.end(), v[i]) - comp.begin();
    g[v[i]].push_back(i);
    g[u[i]].push_back(i);
  }
  int last = -1;
  int t = n;
  for (int i = 0; i < ((int)comp.size()); i++)
    if (((int)g[i].size()) & 1) {
      if (last == -1)
        u[t] = i, last = i;
      else {
        v[t] = i;
        g[last].push_back(t);
        g[i].push_back(t);
        last = -1;
        t++;
      }
    }
  for (int i = 0; i < ((int)comp.size()); i++)
    if (!mark[i]) dfs(i, -1);
  for (int i = 0; i < n; i++) cout << col[i] << ' ';
}
