#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200200;
int fs[MAXN];
int sc[MAXN];
int color[MAXN];
vector<int> g[MAXN];
bool dfs(int v, int c) {
  if (color[v] != -1) {
    return color[v] == c;
  }
  color[v] = c;
  for (int i = 0; i < (int)g[v].size(); i++) {
    if (!dfs(g[v][i], c ^ 1)) {
      return false;
    }
  }
  return true;
}
int main() {
  int n;
  scanf("%d", &n);
  vector<pair<int, int> > ord;
  for (int i = 0; i < n; i++) {
    int l, r;
    scanf("%d%d", &l, &r);
    ord.push_back(make_pair(l - 1, i));
    ord.push_back(make_pair(r, i));
  }
  for (int i = 0; i < n; i++) {
    fs[i] = sc[i] = -1;
  }
  sort(ord.begin(), ord.end());
  for (int i = 0; i < 2 * n; i++) {
    int j = ord[i].second;
    if (fs[j] == -1) {
      fs[j] = i;
    } else {
      sc[j] = i;
    }
  }
  for (int i = 0; i < n; i++) {
    g[2 * i].push_back(2 * i + 1);
    g[2 * i + 1].push_back(2 * i);
    g[fs[i]].push_back(sc[i]);
    g[sc[i]].push_back(fs[i]);
  }
  for (int i = 0; i < 2 * n; i++) {
    color[i] = -1;
  }
  bool ok = true;
  for (int i = 0; i < 2 * n; i++) {
    if (color[i] == -1) {
      ok &= dfs(i, 0);
    }
  }
  if (!ok) {
    puts("-1");
  } else {
    for (int i = 0; i < n; i++) {
      if (i > 0) {
        printf(" ");
      }
      printf("%d", color[fs[i]]);
    }
    printf("\n");
  }
  return 0;
}
