#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
vector<int> adj[N];
vector<int> cur;
int l[N], r[N];
int d[N];
vector<int> fard;
bool mark[N];
vector<int> tour;
unordered_map<int, int> nist[N];
unordered_map<int, bool> ans[N];
void dfs(int x) {
  mark[x] = 1;
  for (int p : adj[x]) {
    if (nist[x][p]) {
      nist[x][p] = nist[p][x] = nist[x][p] - 1;
      dfs(p);
    }
  }
  tour.push_back(x);
}
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> l[i] >> r[i];
    r[i]++;
    cur.push_back(l[i]);
    cur.push_back(r[i]);
  }
  sort(cur.begin(), cur.end());
  cur.resize(unique(cur.begin(), cur.end()) - cur.begin());
  for (int i = 1; i <= n; i++) {
    int m1 = lower_bound(cur.begin(), cur.end(), l[i]) - cur.begin();
    int m2 = lower_bound(cur.begin(), cur.end(), r[i]) - cur.begin();
    adj[m1].push_back(m2);
    adj[m2].push_back(m1);
    d[m1]++;
    d[m2]++;
  }
  for (int i = 0; i < cur.size(); i++)
    if (d[i] % 2 == 1) fard.push_back(i);
  for (int i = 0; i < fard.size(); i += 2) {
    adj[fard[i]].push_back(fard[i + 1]);
    adj[fard[i + 1]].push_back(fard[i]);
  }
  for (int i = 0; i < cur.size(); i++)
    for (int p : adj[i]) nist[i][p]++;
  for (int i = 0; i < cur.size(); i++) {
    if (!mark[i]) {
      tour.clear();
      dfs(i);
      tour.push_back(tour[0]);
      for (int i = 0; i < tour.size() - 1; i++) {
        if (tour[i] < tour[i + 1])
          ans[tour[i]][tour[i + 1]] = ans[tour[i + 1]][tour[i]] = 1;
        else
          ans[tour[i]][tour[i + 1]] = ans[tour[i + 1]][tour[i]] = 0;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    int m1 = lower_bound(cur.begin(), cur.end(), l[i]) - cur.begin();
    int m2 = lower_bound(cur.begin(), cur.end(), r[i]) - cur.begin();
    cout << ans[m1][m2] << "\n";
  }
  return 0;
}
