#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200010;
vector<int> p[MAXN];
int vis[MAXN], ans[MAXN][2];
multimap<int, int> h;
int tot = 0;
void dfs(int x, int y) {
  if (vis[x] >= 0)
    return;
  else
    vis[x] = y;
  int sz = p[x].size();
  for (int i = 0; i < sz; i++) dfs(p[x][i], 1 ^ y);
}
int main() {
  memset(vis, -1, sizeof(vis));
  int n;
  scanf("%d", &n);
  int l, r;
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &l, &r);
    p[i << 1].push_back(i << 1 | 1);
    p[i << 1 | 1].push_back(i << 1);
    h.insert(make_pair(l << 1, i << 1));
    h.insert(make_pair(r << 1 | 1, i << 1 | 1));
  }
  multimap<int, int>::iterator it = h.begin();
  for (int i = 0; i < n; i++) {
    int l = it->second;
    it++;
    int r = it->second;
    it++;
    p[l].push_back(r);
    p[r].push_back(l);
  }
  for (int i = 0; i < n; i++)
    if (vis[i << 1] < 0) dfs(i << 1, 1);
  for (int i = 0; i < n; i++) printf("%d ", vis[i << 1]);
  return 0;
}
