#include <bits/stdc++.h>
using namespace std;
inline int get() {
  char c;
  while (!isdigit(c = getchar()))
    ;
  int v = c - 48;
  while (isdigit(c = getchar())) v = v * 10 + c - 48;
  return v;
}
int n;
pair<int, int> a[200005];
bool vis[200005], c[200005];
vector<int> G[200005];
void dfs(int x, int col) {
  vis[x] = 1;
  c[x] = col;
  for (int i = 0; i < G[x].size(); ++i)
    if (!vis[G[x][i]]) dfs(G[x][i], col ^ 1);
}
int main() {
  n = get();
  for (int i = 1, l, r; i <= n; ++i) {
    l = get();
    r = get();
    a[i * 2 - 1] = make_pair(2 * l, 2 * i - 1);
    a[i * 2] = make_pair(2 * r + 1, 2 * i);
    G[2 * i - 1].push_back(2 * i);
    G[2 * i].push_back(2 * i - 1);
  }
  sort(a + 1, a + 2 * n + 1);
  for (int i = 1, u, v; i <= n; ++i) {
    u = a[2 * i - 1].second;
    v = a[2 * i].second;
    G[u].push_back(v);
    G[v].push_back(u);
  }
  for (int i = 1; i <= 2 * n; ++i)
    if (!vis[i]) dfs(i, 0);
  for (int i = 1; i <= n; ++i) printf("%d ", c[i * 2]);
  return 0;
}
