#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e6 + 7;
const long long mod = 1e9 + 7;
const long long INF = 2e5 + 7;
const long long mlog = 20;
const long long SQ = 400;
long long L[maxn], R[maxn];
vector<long long> adj[maxn];
long long mark[maxn], vis[maxn], col[maxn];
void dfs(long long v, long long ind) {
  if (ind != -1) vis[ind] = true;
  mark[v] = true;
  for (long long u : adj[v])
    if (!vis[u]) dfs(L[u] ^ R[u] ^ v, u);
  if (ind != -1) {
    long long c = L[ind] ^ R[ind] ^ v;
    if (c < v)
      col[ind] = 1;
    else
      col[ind] = 0;
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false), cin.tie(), cout.tie();
  ;
  long long n;
  cin >> n;
  vector<long long> vals;
  for (long long i = 0; i < n; i++) {
    cin >> L[i] >> R[i];
    R[i]++;
    vals.push_back(L[i]), vals.push_back(R[i]);
  }
  sort(vals.begin(), vals.end());
  vals.resize(unique(vals.begin(), vals.end()) - vals.begin());
  for (long long i = 0; i < n; i++) {
    L[i] = lower_bound(vals.begin(), vals.end(), L[i]) - vals.begin();
    R[i] = lower_bound(vals.begin(), vals.end(), R[i]) - vals.begin();
    adj[R[i]].push_back(i), adj[L[i]].push_back(i);
  }
  long long last = -1;
  long long cnt = n;
  for (long long i = 0; i < vals.size(); i++) {
    if (adj[i].size() % 2 == 1) {
      if (last == -1)
        L[cnt] = i, last = i;
      else {
        R[cnt] = i;
        adj[last].push_back(cnt);
        adj[i].push_back(cnt);
        last = -1;
        cnt++;
      }
    }
  }
  for (long long i = 0; i < vals.size(); i++)
    if (!mark[i]) dfs(i, -1);
  for (long long i = 0; i < n; i++) cout << col[i] << " ";
  return 0;
}
