#include <bits/stdc++.h>
using namespace std;
void RI() {}
template <typename... T>
void RI(int& head, T&... tail) {
  scanf("%d", &head);
  RI(tail...);
}
mt19937 rng(0x5EED);
int randint(int lb, int ub) {
  return uniform_int_distribution<int>(lb, ub)(rng);
}
const int MX = 400005;
struct Lisan {
  vector<int> seq;
  void build() {
    sort(seq.begin(), seq.end());
    seq.resize(unique(begin(seq), end(seq)) - begin(seq));
  }
  void add(int x) { seq.push_back(x); }
  int ask(int x) { return lower_bound(begin(seq), end(seq), x) - begin(seq); }
} lisan;
struct Segment {
  int l, r;
} ip[MX];
struct Edge {
  int u, v, id;
};
bool operator<(Segment a, Segment b) { return tie(a.l, a.r) < tie(b.l, b.r); }
int N, x[MX], vst[MX], ans[MX], bye[MX];
vector<Edge> E[MX];
vector<Edge> path;
void add_edge(int u, int v, int id) {
  E[u].push_back({u, v, id});
  E[v].push_back({v, u, id});
}
void DFS(int u) {
  vst[u] = 1;
  for (auto it : E[u]) {
    int v = it.v;
    int id = it.id;
    if (bye[id]) continue;
    bye[id] = 1;
    DFS(v);
    path.push_back({v, u, id});
  }
}
int main(int argc, char** argv) {
  RI(N);
  for (int i = 0; i < N; i++) {
    RI(ip[i].l, ip[i].r);
    ip[i].r++;
    lisan.add(ip[i].l);
    lisan.add(ip[i].r);
  }
  lisan.build();
  for (int i = 0; i < N; i++) {
    ip[i].l = lisan.ask(ip[i].l);
    ip[i].r = lisan.ask(ip[i].r);
    add_edge(ip[i].l, ip[i].r, i);
  }
  int V = ((int)((lisan.seq).size()));
  int M = N;
  for (int i = 0; i < V; i++) {
    if (((int)((E[i]).size())) % 2 == 0) continue;
    int j = i + 1;
    while (j < V && ((int)((E[j]).size())) % 2 == 0) {
      j++;
    }
    add_edge(i, j, M++);
    i = j;
  }
  for (int i = 0; i < V; i++) {
    if (!vst[i]) {
      DFS(i);
    }
  }
  for (auto it : path) {
    int u = it.u;
    int v = it.v;
    int id = it.id;
    if (u < v)
      ans[id] = 0;
    else
      ans[id] = 1;
  }
  for (int i = 0; i < N; i++) {
    printf("%d%c", ans[i], i == N - 1 ? '\n' : ' ');
  }
  return 0;
}
