Problem: There are n segments [l_i, r_i] for 1 ≤ i ≤ n. You should divide all segments into two non-empty groups in such way that there is no pair of segments from different groups which have at least one common point, or say that it's impossible to do it. Each segment should belong to exactly one group.

To optimize testing process you will be given multitest.

Input

The first line contains one integer T (1 ≤ T ≤ 50000) — the number of queries. Each query contains description of the set of segments. Queries are independent.

First line of each query contains single integer n (2 ≤ n ≤ 10^5) — number of segments. It is guaranteed that ∑{n} over all queries does not exceed 10^5.

The next n lines contains two integers l_i, r_i per line (1 ≤ l_i ≤ r_i ≤ 2 ⋅ 10^5) — the i-th segment.

Output

For each query print n integers t_1, t_2, ..., t_n (t_i ∈ \{1, 2\}) — for each segment (in the same order as in the input) t_i equals 1 if the i-th segment will belongs to the first group and 2 otherwise.

If there are multiple answers, you can print any of them. If there is no answer, print -1.

Example

Input


3
2
5 5
2 3
3
3 5
2 3
2 3
3
3 3
4 4
5 5


Output


2 1 
-1
1 1 2 

Note

In the first query the first and the second segments should be in different groups, but exact numbers don't matter.

In the second query the third segment intersects with the first and the second segments, so they should be in the same group, but then the other group becomes empty, so answer is -1.

In the third query we can distribute segments in any way that makes groups non-empty, so any answer of 6 possible is correct.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool read(T &x) {
  int c = getchar();
  int sgn = 1;
  while (~c && c<'0' | c> '9') {
    if (c == '-') sgn = -1;
    c = getchar();
  }
  for (x = 0; ~c && '0' <= c && c <= '9'; c = getchar()) x = x * 10 + c - '0';
  x *= sgn;
  return ~c;
}
template <class T>
inline long long gcd(T a, T b) {
  a = abs(a);
  b = abs(b);
  while (b) {
    a = a % b;
    swap(a, b);
  }
  return a;
}
template <class T>
inline long long ext_gcd(T A, T B, T *X, T *Y) {
  T x2, y2, x1, y1, x, y, r2, r1, q, r;
  x2 = 1;
  y2 = 0;
  x1 = 0;
  y1 = 1;
  for (r2 = A, r1 = B; r1 != 0;
       r2 = r1, r1 = r, x2 = x1, y2 = y1, x1 = x, y1 = y) {
    q = r2 / r1;
    r = r2 % r1;
    x = x2 - (q * x1);
    y = y2 - (q * y1);
  }
  *X = x2;
  *Y = y2;
  return r2;
}
template <class T>
inline long long modInv(T a, T m) {
  T x, y;
  ext_gcd(a, m, &x, &y);
  x %= m;
  if (x < 0) x += m;
  return x;
}
template <class T>
inline long long power(T a, T p) {
  T res = 1, x = a;
  while (p) {
    if (p & 1) res = (res * x);
    x = (x * x);
    p >>= 1;
  }
  return res;
}
template <class T>
inline long long bigmod(T a, T p, T m) {
  T res = 1 % m, x = a % m;
  while (p) {
    if (p & 1) res = (res * x) % m;
    x = (x * x) % m;
    p >>= 1;
  }
  return res;
}
struct node {
  int x, y, pos, group;
  node(int _x, int _y, int _pos, int _group) {
    x = _x;
    y = _y;
    pos = _pos;
    group = _group;
  }
};
vector<int> ans;
vector<node> v;
bool cmp(node a, node b) {
  if (a.y == b.y) return a.x < b.x;
  return a.x < b.x;
}
bool cmp2(node a, node b) { return a.pos < b.pos; }
int main() {
  int tc;
  cin >> tc;
  while (tc--) {
    v.clear();
    int n;
    cin >> n;
    int l, r;
    for (int i = 1; i <= n; i++) {
      cin >> l >> r;
      v.push_back(node(l, r, i, -1));
    }
    sort(v.begin(), v.end(), cmp);
    int firstGroupMax = v[0].y, secondGroupMax = -1;
    v[0].group = 1;
    bool Two = 0;
    for (int i = 1; i < n; i++) {
      int current = v[i].x;
      if (current > firstGroupMax && Two == 0) {
        v[i].group = 2;
        Two = 1;
        secondGroupMax = v[i].y;
      } else if (current <= firstGroupMax) {
        v[i].group = 1;
        firstGroupMax = max(v[i].y, firstGroupMax);
      } else if (current <= secondGroupMax) {
        v[i].group = 2;
        secondGroupMax = max(v[i].y, secondGroupMax);
      } else {
        v[i].group = 1;
        firstGroupMax = max(v[i].y, firstGroupMax);
      }
    }
    sort(v.begin(), v.end(), cmp2);
    if (!Two) {
      puts("-1");
      continue;
    }
    bool isAvailable = 0, isMinus = 0;
    for (int i = 0; i < n; i++) {
      if (v[i].group == -1) {
        isMinus = 1;
        break;
      }
    }
    if (isMinus) {
      puts("-1");
    } else {
      for (int i = 0; i < n; i++) {
        printf("%d ", v[i].group);
      }
      puts("");
    }
  }
  return 0;
}