#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 100;
const int E = 2e5 + 100;
int n;
int l[N], r[N];
vector<int> x;
vector<int> g[N];
vector<int> tour;
int to[E], mark[E], ecnt;
int from[E], c[E];
void add(int u, int v) {
  from[ecnt] = u, to[ecnt] = v;
  g[u].push_back(ecnt);
  g[v].push_back(ecnt);
  ecnt++;
}
void dfs(int v) {
  while (((int)g[v].size())) {
    int id = g[v].back();
    g[v].pop_back();
    int u = from[id] + to[id] - v;
    if (!mark[id]) {
      mark[id] = true;
      dfs(u);
      if (u < v)
        c[id] = 1;
      else
        c[id] = 0;
    }
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> l[i] >> r[i];
    r[i]++;
    x.push_back(l[i]);
    x.push_back(r[i]);
  }
  sort(x.begin(), x.end());
  x.resize(unique(x.begin(), x.end()) - x.begin());
  for (int i = 0; i < n; ++i) {
    l[i] = lower_bound(x.begin(), x.end(), l[i]) - x.begin();
    r[i] = lower_bound(x.begin(), x.end(), r[i]) - x.begin();
    add(l[i], r[i]);
  }
  int lst = -1;
  for (int i = 0; i < 2 * n; ++i) {
    if (((int)g[i].size()) & 1) {
      if (lst == -1)
        lst = i;
      else {
        add(lst, i);
        lst = -1;
      }
    }
  }
  for (int i = 0; i < 2 * n; i++)
    if (!g[i].empty()) dfs(i);
  for (int i = 0; i < n; i++) cout << c[i] << " ";
  cout << endl;
  return 0;
}
