#include <bits/stdc++.h>
using namespace std;
const int maxx = 2e5 + 20;
map<int, int> val;
set<int> s;
int deg[maxx], ans[maxx], from[maxx], to[maxx], n, m, cnt = 0, T = 0;
vector<int> g[maxx], odd;
pair<int, int> e[maxx];
bool mark[maxx];
void add_edge(int x, int y) {
  g[x].push_back(T);
  g[y].push_back(T);
  from[T] = x;
  to[T] = y;
  deg[x]++;
  deg[y]++;
  T++;
}
void dfs(int root) {
  while (g[root].size()) {
    int e = g[root].back();
    g[root].pop_back();
    int x = from[e] + to[e] - root;
    if (!mark[e]) {
      mark[e] = true;
      dfs(x);
      if (root < x)
        ans[e] = 1;
      else
        ans[e] = 0;
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> m;
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    b++;
    e[i] = {a, b};
    s.insert(a);
    s.insert(b);
  }
  for (int x : s) val[x] = cnt++;
  for (int i = 0; i < m; i++) {
    e[i] = {val[e[i].first], val[e[i].second]};
    add_edge(e[i].first, e[i].second);
  }
  for (int i = 0; i < m + m; i++)
    if (deg[i] % 2) odd.push_back(i);
  for (int i = 0; i < odd.size(); i += 2) add_edge(odd[i], odd[i + 1]);
  for (int i = 0; i < m + m; i++)
    if (g[i].size()) dfs(i);
  for (int i = 0; i < m; i++) cout << ans[i] << " ";
  cout << endl;
  return 0;
}
