#include <bits/stdc++.h>
const int maxn = 100005;
using namespace std;
struct node {
  int l, r, id;
  bool friend operator<(const node u, const node v) {
    if (u.l == v.l) return u.r < v.r;
    return u.l < v.l;
  }
} p[maxn];
int vis[maxn];
int main() {
  int t, n;
  cin >> t;
  while (t--) {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
      scanf("%d %d", &p[i].l, &p[i].r);
      p[i].id = i;
      vis[i] = 2;
    }
    sort(p + 1, p + 1 + n);
    int R = p[1].r;
    vis[p[1].id] = 1;
    bool fg = 0;
    for (int i = 2; i <= n; i++) {
      if (p[i].l <= R) {
        R = max(R, p[i].r);
        vis[p[i].id] = 1;
      } else {
        fg = 1;
        break;
      }
    }
    if (fg) {
      for (int i = 1; i <= n; i++) {
        printf("%d ", vis[i]);
      }
    } else {
      printf("-1");
    }
    printf("\n");
  }
  return 0;
}
