#include <bits/stdc++.h>
using namespace std;
tuple<int, int, int> a[100010];
int id[100010];
void sol() {
  int n;
  scanf("%d", &n);
  for (int i = (1); i <= (n); ++i) {
    get<2>(a[i]) = i;
    scanf("%d%d", &get<0>(a[i]), &get<1>(a[i]));
  }
  sort(a + 1, a + n + 1);
  int r = get<1>(a[1]);
  for (int i = (1); i <= (n); ++i) id[get<2>(a[i])] = i;
  for (int i = (2); i <= (n); ++i) {
    if (get<0>(a[i]) > r) {
      for (int j = (1); j <= (n); ++j) printf("%d ", 1 + (id[j] >= i));
      printf("\n");
      return;
    }
    r = max(r, get<1>(a[i]));
  }
  printf("-1\n");
}
int main() {
  int T;
  for (scanf("%d", &T); T--;) sol();
}
