#include <bits/stdc++.h>
using namespace std;
const int maxn = 4e5 + 85 - 69;
bool mark[maxn], emark[maxn], ans[maxn];
int frm[maxn], too[maxn], n;
set<pair<pair<int, int>, int> > s;
vector<int> adj[maxn], tour, all;
int idof(int x) { return lower_bound(all.begin(), all.end(), x) - all.begin(); }
void dfs(int u) {
  mark[u] = true;
  while (((int)(adj[u]).size())) {
    int e = adj[u].back();
    adj[u].pop_back();
    if (emark[e]) continue;
    emark[e] = true;
    dfs(frm[e] + too[e] - u);
  }
  tour.push_back(u);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> frm[i] >> too[i], too[i]++;
    all.push_back(frm[i]);
    all.push_back(too[i]);
  }
  sort(all.begin(), all.end());
  for (int i = 0; i < n; i++) {
    frm[i] = idof(frm[i]);
    too[i] = idof(too[i]);
    s.insert(make_pair(make_pair(frm[i], too[i]), i));
    adj[frm[i]].push_back(i);
    adj[too[i]].push_back(i);
  }
  int lst = -1, oecnt = 0;
  for (int i = 0; i < ((int)(all).size()); i++) {
    if (((int)(adj[i]).size()) & 1) {
      if (lst == -1)
        lst = i;
      else {
        int id = n + oecnt;
        frm[id] = lst, too[id] = i;
        adj[lst].push_back(id);
        adj[i].push_back(id);
        s.insert(make_pair(make_pair(frm[id], too[id]), id));
        oecnt++, lst = -1;
      }
    }
  }
  for (int ii = 0; ii < ((int)(all).size()); ii++)
    if (!mark[ii]) {
      tour.clear();
      dfs(ii);
      for (int i = 0; i + 1 < ((int)(tour).size()); i++) {
        int u = tour[i], v = tour[i + 1];
        auto it = s.lower_bound(make_pair(make_pair(min(v, u), max(v, u)), -1));
        ans[it->second] = u < v;
        s.erase(it);
      }
    }
  for (int i = 0; i < n; i++) cout << ans[i] << ' ';
  cout << '\n';
  return 0;
}
