#include <bits/stdc++.h>
using namespace std;
const long long maxn = 5e5 + 100;
const long long mod = 1e9 + 7;
const long long inf = 1e18;
long long n, c[maxn], l[maxn], r[maxn], t, st, ans[maxn];
bool vis[maxn];
map<long long, long long> mp, e[maxn];
vector<long long> vec;
set<pair<long long, long long> > g[maxn];
void tur(long long v) {
  long long u = -1;
  set<pair<long long, long long> >::iterator it =
      g[v].lower_bound(make_pair(u, -1ll));
  while (it != g[v].end()) {
    u = it->first;
    g[u].erase(make_pair(v, it->second));
    g[v].erase(it);
    tur(u);
    it = g[v].lower_bound(make_pair(u, -1ll));
  };
  vec.push_back(v);
}
int main() {
  long long x;
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> l[i] >> r[i];
    r[i]++;
    vec.push_back(l[i]);
    vec.push_back(r[i]);
  }
  sort(vec.begin(), vec.end());
  for (long long i = 0; i < vec.size(); i++) {
    if (i == 0 || vec[i] != vec[i - 1]) mp[vec[i]] = t++;
  }
  for (long long i = 0; i < n; i++) {
    l[i] = mp[l[i]];
    r[i] = mp[r[i]];
    e[l[i]][r[i]] = st;
    e[r[i]][l[i]] = st++;
    g[l[i]].insert(make_pair(r[i], i));
    g[r[i]].insert(make_pair(l[i], i));
  }
  x = -1;
  for (long long i = 0; i < t; i++) {
    if (g[i].size() % 2) {
      if (x != -1)
        g[x].insert(make_pair(i, n + 10)), g[i].insert(make_pair(x, n + 10)),
            e[i][x] = n, e[x][i] = n, x = -1;
      else
        x = i;
    }
  }
  for (long long i = 0; i < n; i++) {
    e[l[i]][r[i]] = i;
    e[r[i]][l[i]] = i;
  }
  for (long long j = 0; j < t; j++) {
    vec.clear();
    tur(j);
    if (vec.size() > 1) vec.push_back(vec[0]);
    for (long long i = 0; i + 1 < vec.size(); i++) {
      if (vec[i] > vec[i + 1]) ans[e[vec[i]][vec[i + 1]]] = 1;
    }
  }
  for (long long i = 0; i < n; i++) {
    cout << ans[i] << " ";
  }
  return 0;
}
