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 JAVA):

Solution:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;

import java.util.*;


public class Soly
{
    static final int INF = Integer.MAX_VALUE;

    static void mergeSort(int[] a,int [] c, int b, int e)
    {
        if(b < e)
        {
            int q = (b + e) >>1;
            mergeSort(a,c, b, q);
            mergeSort(a, c,q + 1, e);
            merge(a,c, b, q, e);
        }
    }


    static void merge(int[] a,int[]c, int b, int mid, int e)
    {
        int n1 = mid - b + 1;
        int n2 = e - mid;
        int[] L = new int[n1+1], R = new int[n2+1];
        int[] L1 = new int[n1+1], R1 = new int[n2+1];

        for(int i = 0; i < n1; i++) {
            L[i] = a[b + i];
            L1[i] = c[b + i];
        }
        for(int i = 0; i < n2; i++)  {
            R[i] = a[mid + 1 + i];
            R1[i] = c[mid + 1 + i];
        }
        L[n1] = R[n2] = INF;

        for(int k = b, i = 0, j = 0; k <= e; k++)
            if(L[i] <= R[j]){
                a[k] = L[i];
                c[k] = L1[i++];
            }

            else
            {
                a[k] = R[j];
                c[k] = R1[j++];
            }
    }
    static int s;
            static Stack<Character> sta;
static int type(char[] a){
        sta= new Stack<>();
        s=0;
        int op=0,cl=0;
    for (int i = 0; i < a.length; i++) {
        if (a[i]==')'){
            if (!sta.isEmpty()&&sta.peek()=='('){
                op--;
                sta.pop();
            }
            else{
                cl++;
                sta.push(')');
            }
        }
        else{
            op++;
           sta.push('(');
        }
    }
    if (sta.isEmpty())return 0;
    else{
        s=sta.size();
        //1 --> closing
        //2 -->opening
        if (op>0&&cl>0)return 50;
        else{
            if (op>0)return 2;
            return 1;
        }

    }
}



    public static void main(String[] args) throws IOException {
        Scanner in = new Scanner(System.in);
        try (PrintWriter or = new PrintWriter(System.out)) {
            int t=in.nextInt();
            for(int q=0;q<t;++q){
                int n=in.nextInt();
                ArrayList<coooo> d= new ArrayList<>();
                for (int i = 0; i < n; i++){
                    d.add(new coooo(in.nextInt(),in.nextInt(),i));
                }
                Collections.sort(d);

                int [] cnt=new int[n];
                boolean r=false;

                cnt[d.get(0).ind]=1;
                int ans=d.get(0).y;
                for (int  i = 1; i < d.size(); i++) {
                        coooo u = d.get(i);
                        if (u.x>ans){
                            cnt[u.ind]=2;
                            r=true;
                        }
                        else{
                            cnt[u.ind]=1;
                            ans=Math.max(ans,u.y);
                        }
                }

                if (r){
                    for (int k:cnt)or.print(k+" ");
                    or.println();
                }else {
                    or.println(-1);
                }
            }

        }
        }











    static class Scanner {

        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens()) {
                st = new StringTokenizer(br.readLine());
            }
            return st.nextToken();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++) {
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec) {
                        f *= 10;
                    }
                }
            }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        }

        public boolean ready() throws IOException {
            return br.ready();
        }

    }



}
class coooo implements Comparable<coooo> {
    int x,y,ind;

    public coooo(int x, int y, int ind) {
        this.x = x;
        this.y = y;
        this.ind = ind;
    }

    @Override
    public int compareTo(coooo o) {
        if (x!=o.x)return x-o.x;
        return y-o.y;
    }
}