#include <bits/stdc++.h>
using namespace std;
void RD(int &x) { scanf("%d", &x); }
void RD(long long &x) { scanf("%I64d", &x); }
void RD(unsigned long long &x) { scanf("%I64u", &x); }
void RD(unsigned int &x) { scanf("%u", &x); }
void RD(double &x) { scanf("%lf", &x); }
void RD(int &x, int &y) { scanf("%d%d", &x, &y); }
void RD(long long &x, long long &y) { scanf("%I64d%I64d", &x, &y); }
void RD(unsigned int &x, unsigned int &y) { scanf("%u%u", &x, &y); }
void RD(double &x, double &y) { scanf("%lf%lf", &x, &y); }
void RD(int &x, int &y, int &z) { scanf("%d%d%d", &x, &y, &z); }
void RD(long long &x, long long &y, long long &z) {
  scanf("%I64d%I64d%I64d", &x, &y, &z);
}
void RD(unsigned int &x, unsigned int &y, unsigned int &z) {
  scanf("%u%u%u", &x, &y, &z);
}
void RD(double &x, double &y, double &z) { scanf("%lf%lf%lf", &x, &y, &z); }
void RD(char &x) { x = getchar(); }
void RD(char *s) { scanf("%s", s); }
void RD(string &s) { cin >> s; }
void PR(int x) { printf("%d\n", x); }
void PR(int x, int y) { printf("%d %d\n", x, y); }
void PR(long long x) { printf("%I64d\n", x); }
void PR(unsigned int x) { printf("%u\n", x); }
void PR(unsigned long long x) { printf("%I64u\n", x); }
void PR(double x) { printf("%.3lf\n", x); }
void PR(char x) { printf("%c\n", x); }
void PR(char *x) { printf("%s\n", x); }
void PR(string x) { cout << x << endl; }
void upMin(int &x, int y) {
  if (x > y) x = y;
}
void upMin(long long &x, long long y) {
  if (x > y) x = y;
}
void upMin(double &x, double y) {
  if (x > y) x = y;
}
void upMax(int &x, int y) {
  if (x < y) x = y;
}
void upMax(long long &x, long long y) {
  if (x < y) x = y;
}
void upMax(double &x, double y) {
  if (x < y) x = y;
}
int sgn(double x) {
  if (x > 1e-8) return 1;
  if (x < -1e-8) return -1;
  return 0;
}
long long Gcd(long long x, long long y) {
  if (y == 0) return x;
  return Gcd(y, x % y);
}
long long Lcm(long long x, long long y) { return x / Gcd(x, y) * y; }
long long eular(long long n) {
  long long ans = n, i;
  for (i = 2; i * i <= n; i++)
    if (n % i == 0) {
      ans -= ans / i;
      while (n % i == 0) n /= i;
    }
  if (n > 1) ans -= ans / n;
  return ans;
}
long long exGcd(long long a, long long b, long long &x, long long &y) {
  if (b == 0) {
    x = 1;
    y = 0;
    return a;
  }
  long long temp = exGcd(b, a % b, x, y);
  long long t = x;
  x = y;
  y = t - a / b * y;
  return temp;
}
long long gcdReverse(long long a, long long b) {
  long long x, y;
  exGcd(a, b, x, y);
  x %= b;
  if (x < 0) x += b;
  return x;
}
long long myPow(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = ans * a;
    a = a * a;
    b >>= 1;
  }
  return ans;
}
long long myPow(long long a, long long b, long long mod) {
  a %= mod;
  long long ans = 1;
  while (b) {
    if (b & 1) ans = ans * a % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return ans;
}
int getInt() {
  int x = 0;
  char c = getchar();
  while (!isdigit(c)) c = getchar();
  while (isdigit(c)) {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x;
}
long long getSqrt(long long t) {
  long long p = sqrt(1.0 * t);
  while (p * p > t) p--;
  while ((p + 1) <= t / (p + 1)) p++;
  return p;
}
const int mod = 1000000007;
const long long inf = (((long long)1) << 61) + 5;
const double dinf = 1000000000;
const int INF = 1000000005;
const int N = 200005;
int isPrime[N];
vector<int> prime;
void initPrime() {
  int i, j;
  for (i = 2; i < N; i++)
    if (!isPrime[i]) {
      prime.push_back(i);
      for (j = i + i; j < N; j += i) isPrime[j] = 1;
    }
}
vector<int> g[N];
int n, a[N], b[N];
vector<pair<int, int> > p;
void DFS(int u, int col) {
  b[u] = 1;
  if (u % 2 == 0) a[u >> 1] = col;
  int i;
  for (i = 0; i < g[u].size(); i++) {
    int v = g[u][i];
    if (!b[v]) DFS(v, col ^ 1);
  }
}
int main() {
  RD(n);
  int i;
  for (i = 0; i < n; i++) {
    int x, y;
    RD(x, y);
    y++;
    p.push_back(make_pair(x, i * 2));
    p.push_back(make_pair(y, i * 2 + 1));
    g[i * 2].push_back(i * 2 + 1);
    g[i * 2 + 1].push_back(i * 2);
  }
  sort(p.begin(), p.end());
  for (i = 0; i + 1 < p.size(); i += 2) {
    int x = p[i].second;
    int y = p[i + 1].second;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  for (i = 0; i < 2 * n; i++)
    if (!b[i]) DFS(i, 0);
  for (i = 0; i < n - 1; i++) printf("%d ", a[i]);
  PR(a[i]);
}
