#include <bits/stdc++.h>
using namespace std;
const int N = 4e5 + 5;
vector<int> adj[N];
vector<int> v, frd;
int from[N], to[N], RT[N], n, nn;
bitset<N> B;
void DFS(int u) {
  while (adj[u].size()) {
    int e = adj[u].back();
    adj[u].pop_back();
    if (B[e]) continue;
    B[e] = 1;
    RT[e] = (u < (from[e] ^ to[e] ^ u));
    DFS(from[e] ^ to[e] ^ u);
  }
}
int main() {
  scanf("%d", &n);
  nn = n;
  for (int i = 0; i < n; i++) {
    scanf("%d %d", &from[i], &to[i]);
    to[i]++;
    v.push_back(from[i]);
    v.push_back(to[i]);
    v.push_back(to[i] - 1);
  }
  set<int> st(v.begin(), v.end());
  v.assign(st.begin(), st.end());
  for (int i = 0; i < n; i++) {
    from[i] = lower_bound(v.begin(), v.end(), from[i]) - v.begin();
    to[i] = lower_bound(v.begin(), v.end(), to[i]) - v.begin();
    adj[from[i]].push_back(i);
    adj[to[i]].push_back(i);
  }
  for (int i = 0; i < N; i++)
    if ((int)adj[i].size() & 1) frd.push_back(i);
  while (frd.size()) {
    int u = frd.back();
    frd.pop_back();
    int v = frd.back();
    frd.pop_back();
    adj[u].push_back(nn);
    adj[v].push_back(nn);
    from[nn] = u;
    to[nn++] = v;
  }
  for (int i = 0; i < N; i++) DFS(i);
  for (int i = 0; i < n; i++) printf("%d ", RT[i]);
}
