#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
int p[maxn], w[maxn];
vector<pair<pair<int, int>, int>> a;
int find(int x) {
  if (p[x] == x)
    return x;
  else {
    int ret = find(p[x]);
    w[x] ^= w[p[x]];
    return p[x] = ret;
  }
}
int main() {
  int l, r, n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> l >> r;
    a.push_back(make_pair(make_pair(l, 0), i));
    a.push_back(make_pair(make_pair(r, 1), i));
  }
  sort(a.begin(), a.end());
  for (int i = 0; i < n; i++) p[i] = i;
  for (int i = 0; i < a.size(); i += 2)
    if (a[i].second != a[i + 1].second) {
      int ret = a[i].first.second == a[i + 1].first.second;
      int u = a[i].second, v = a[i + 1].second;
      if (find(u) == find(v)) {
        if (w[u] ^ w[v] ^ ret) {
          cout << -1 << endl;
          return 0;
        }
      } else {
        w[p[v]] = ret ^ w[v];
        p[p[v]] = u;
      }
    }
  for (int i = 0; i < n; i++) {
    find(i);
    cout << w[i] << ' ';
  }
  cout << endl;
  return 0;
}
