#include <cassert>
#include <cstdio>
#include <cstring>
#include <algorithm>

int *f;

bool pless( const int &i, const int &j )
{
  return f[i] < f[j];
}

int main()
{
  using namespace std;
  assert(freopen("show.in", "r", stdin) == stdin);
  assert(freopen("show.out", "w", stdout) == stdout);

  int n;
  assert(scanf("%d", &n) == 1);
  int *s = new int[n], *f = new int[n], *p = new int[n];
  for (int i = 0; i < n; i++)
  {
    assert(scanf("%d%d", &s[i], &f[i]) == 2);
    f[i] += s[i];
    p[i] = i;
  }
  ::f = f;
  sort(p, p + n, pless);
  int **d = new int*[n + 1], **pi = new int*[n + 1], **pj = new int*[n + 1];
  for (int i = 0; i <= n; i++)
  {
    d[i] = new int[n + 1];
    pi[i] = new int[n + 1];
    pj[i] = new int[n + 1];
    memset(d[i], 0x80, sizeof(d[i][0]) * (n + 1));
  }
  d[0][0] = 0;
  pi[0][0] = pj[0][0] = -1;
  int ii = 0, jj = 0;
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= n; j++)
    {
      if (d[i][j] < 0)
        continue;
      if (d[i][j] > d[ii][jj])
        ii = i, jj = j;
      int sum = 0;
      for (int k = i; k < n; k++)
      {
        if (i == 0 || f[p[i - 1]] <= s[p[k]])
          sum++;
        if (d[k + 1][j + sum] < d[i][j])
        {
          d[k + 1][j + sum] = d[i][j];
          pi[k + 1][j + sum] = i;
          pj[k + 1][j + sum] = j;
        }
        if (d[k + 1][abs(j - sum)] < min(d[i][j] + sum, d[i][j] + j))
        {
          d[k + 1][abs(j - sum)] = min(d[i][j] + sum, d[i][j] + j);
          pi[k + 1][abs(j - sum)] = i;
          pj[k + 1][abs(j - sum)] = j;
        }
      }
    }
  int *ans = new int[n], cur = 1;
  // А здесь ans надо заполнить нулями. Иногда это делается автоматически.
  while (ii != 0 || jj != 0)
  {
    int i1 = pi[ii][jj];
    int j1 = pj[ii][jj];
    int sum = 0;
    for (int i = 0; i < n; i++)
      if ((i1 == 0 || s[i] >= f[p[i1 - 1]]) && f[i] <= f[p[ii - 1]])
        ans[i] = cur, sum++;;
    if (d[ii][jj] != d[i1][j1] || jj != j1 + sum)
      cur = 3 - cur;
    ii = i1, jj = j1;
  }
  for (int i = 0; i < n; i++)
    printf("%d%c", ans[i], "\n "[i < n - 1]);

  delete[] s, delete[] f, delete[] p;
  for (int i = 0; i <= n; i++)
    delete[] d[i], delete[] pi[i], delete[] pj[i];
  delete[] d, delete[] pi, delete[] pj;
  return 0;
}

