#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  int mini1 = INT_MAX;
  int visi[n];
  vector<pair<int, int>> v1, v2;
  int ind;
  for (int i = 0; i < n; i++) {
    visi[i] = 1;
    int a1, b1;
    cin >> a1 >> b1;
    v1.push_back({a1, b1});
    v2.push_back({a1, b1});
  }
  sort(v2.begin(), v2.end());
  int g1 = v2[0].second;
  int cnt = 0;
  int cnti = 0;
  for (int i = 0; i < n; i++) {
    if ((v2[i].first <= g1)) {
      cnti++;
      if (v2[i].second > g1) {
        g1 = v2[i].second;
      }
    }
  }
  cnt = 0;
  if (cnti == n) {
    cout << "-1\n";
    return;
  }
  for (int i = 0; i < n; i++) {
    if ((v1[i].second <= g1) && (v2[0].first <= v1[i].first)) {
      cout << "2 ";
    } else
      cout << "1 ";
  }
  cout << "\n";
}
int main() {
  int t = 1;
  cin >> t;
  while (t--) solve();
}
