#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 55;
int V[maxn], U[maxn];
unordered_map<int, int> M;
vector<int> comp;
bitset<maxn> mark, emark, ans;
vector<int> adj[maxn];
void dfs(int v, int E = -1) {
  mark[v] = 1;
  for (auto e : adj[v]) {
    if (!emark[e]) {
      emark[e] = 1;
      dfs(V[e] ^ U[e] ^ v, e);
    }
  }
  if (~E && v == V[E]) ans[E] = 1;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int m;
  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> V[i] >> U[i];
    U[i]++;
    comp.push_back(V[i]);
    comp.push_back(U[i]);
  }
  sort(comp.begin(), comp.end());
  comp.resize(unique(comp.begin(), comp.end()) - comp.begin());
  int n = comp.size();
  for (int i = 0; i < n; i++) M[comp[i]] = i;
  for (int i = 0; i < m; i++) {
    V[i] = M[V[i]];
    U[i] = M[U[i]];
    adj[V[i]].push_back(i);
    adj[U[i]].push_back(i);
  }
  vector<int> D;
  for (int i = 0; i < n; i++) {
    if (adj[i].size() % 2) D.push_back(i);
  }
  for (int i = 0; i < D.size() / 2; i++) {
    V[m + i] = D[2 * i + 0];
    U[m + i] = D[2 * i + 1];
    adj[D[2 * i + 0]].push_back(m + i);
    adj[D[2 * i + 1]].push_back(m + i);
  }
  for (int i = 0; i < n; i++) {
    if (!mark[i]) dfs(i);
  }
  for (int i = 0; i < m; i++) cout << ans[i] << ' ';
}
