#include <bits/stdc++.h>
using namespace std;
int n, s[100005][2], sm = 0, d[200005], ds = 0, ans[200005];
bool vis[200005];
struct e {
  int x;
  int id;
  bool xz;
} px[200005];
struct edge {
  int v, td, id;
  int c;
  edge(int vv, int tt1, int cc, int ii) { v = vv, td = tt1, c = cc, id = ii; }
};
vector<edge> w[200005];
bool cmp(e a, e b) { return a.x < b.x; }
void add(int u, int v, int id) {
  w[u].push_back(edge(v, w[v].size(), -1, id));
  w[v].push_back(edge(u, w[u].size() - 1, -1, id));
}
void dfs(int x) {
  vis[x] = 1;
  for (int i = 0; i < int(w[x].size()); i++) {
    if (w[x][i].c == -1) {
      int ee = 0;
      if (x < w[x][i].v) ee = 1;
      w[x][i].c = w[w[x][i].v][w[x][i].td].c = ee;
      ans[w[x][i].id] = ee;
      dfs(w[x][i].v);
    }
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d %d", &s[i][0], &s[i][1]);
    s[i][1]++;
    px[++sm].x = s[i][0], px[sm].id = i, px[sm].xz = 0;
    px[++sm].x = s[i][1], px[sm].id = i, px[sm].xz = 1;
  }
  sort(px + 1, px + sm + 1, cmp);
  int k = 0, io = -1;
  for (int i = 1; i <= sm; i++) {
    if (px[i].x != io) k++, io = px[i].x;
    s[px[i].id][px[i].xz] = k;
  }
  ds = k;
  for (int i = 1; i <= n; i++) {
    add(s[i][0], s[i][1], i);
    d[s[i][0]]++;
    d[s[i][1]]++;
  }
  k = 0;
  int js = n;
  for (int i = 1; i <= ds; i++) {
    if (d[i] & 1) {
      if (k) {
        add(k, i, ++js);
        k = 0;
      } else
        k = i;
    }
  }
  for (int i = 1; i <= ds; i++) {
    if (!vis[i]) dfs(i);
  }
  printf("%d", ans[1]);
  for (int i = 2; i <= n; i++) {
    printf(" %d", ans[i]);
  }
}
