#include <bits/stdc++.h>
using namespace std;
int n;
struct aa {
  int l, r;
} pp[201000];
vector<pair<int, int> > _hash;
vector<pair<int, int> >::iterator it;
int color[201000];
struct node {
  int t, nxt;
} edge[201000 << 3];
int headline[201000], E;
inline void add(int f, int t) {
  edge[E].t = t;
  edge[E].nxt = headline[f];
  headline[f] = E++;
  edge[E].t = f;
  edge[E].nxt = headline[t];
  headline[t] = E++;
}
void dfs(int u, int c) {
  color[u] = c;
  for (int i = headline[u]; ~i; i = edge[i].nxt) {
    int v = edge[i].t;
    if (color[v] == -1) dfs(v, c ^ 1);
  }
}
void solve(void) {
  _hash.clear();
  memset(headline, -1, sizeof(headline));
  E = 0;
  for (int i = 0; i < (n); i++) {
    scanf("%d%d", &pp[i].l, &pp[i].r);
    add(i << 1, i << 1 | 1);
    _hash.push_back(pair<int, int>(pp[i].l << 1, i << 1));
    _hash.push_back(pair<int, int>(pp[i].r << 1 | 1, i << 1 | 1));
  }
  sort(_hash.begin(), _hash.end());
  int ss = _hash.size();
  for (int i = 0; i < ss; i += 2) {
    add(_hash[i].second, _hash[i + 1].second);
  }
  memset(color, -1, sizeof(color));
  for (int i = 0; i < (2 * n); i++) {
    if (color[i] == -1) dfs(i, 0);
  }
  for (int i = 0; i < (n); i++) {
    printf("%d%c", color[i << 1], (i == n - 1) ? '\n' : ' ');
  }
}
int main(void) {
  while (EOF != scanf("%d", &n)) solve();
  return 0;
}
