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:

// LM10: The next Ballon d'Or
import java.util.*;
import java.io.*;
import java.math.*;
public class Main
{
    static class FastReader
    {
        private InputStream mIs;private byte[] buf = new byte[1024];private int curChar,numChars;public FastReader() { this(System.in); }public FastReader(InputStream is) { mIs = is;}
        public int read() {if (numChars == -1) throw new InputMismatchException();if (curChar >= numChars) {curChar = 0;try { numChars = mIs.read(buf);} catch (IOException e) { throw new InputMismatchException();}if (numChars <= 0) return -1; }return buf[curChar++];}
        public String nextLine(){int c = read();while (isSpaceChar(c)) c = read();StringBuilder res = new StringBuilder();do {res.appendCodePoint(c);c = read();}while (!isEndOfLine(c));return res.toString() ;}
        public String next(){int c = read();while (isSpaceChar(c)) c = read();StringBuilder res = new StringBuilder();do {res.appendCodePoint(c);c = read();}while (!isSpaceChar(c));return res.toString();}
        public long l(){int c = read();while (isSpaceChar(c)) c = read();int sgn = 1;if (c == '-') { sgn = -1 ; c = read() ; }long res = 0; do{ if (c < '0' || c > '9') throw new InputMismatchException();res *= 10 ; res += c - '0' ; c = read();}while(!isSpaceChar(c));return res * sgn;}
        public int i(){int c = read() ;while (isSpaceChar(c)) c = read();int sgn = 1;if (c == '-') { sgn = -1 ; c = read() ; }int res = 0;do{if (c < '0' || c > '9') throw new InputMismatchException();res *= 10 ; res += c - '0' ; c = read() ;}while(!isSpaceChar(c));return res * sgn;}
        public double d() throws IOException {return Double.parseDouble(next()) ;}
        public boolean isSpaceChar(int c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; }
        public boolean isEndOfLine(int c) { return c == '\n' || c == '\r' || c == -1; }
        public void scanIntArr(int [] arr){ for(int li=0;li<arr.length;++li){ arr[li]=i();}}
        public void scanLongArr(long [] arr){for (int i=0;i<arr.length;++i){arr[i]=l();}}
        public void shuffle(int [] arr){ for(int i=arr.length;i>0;--i) { int r=(int)(Math.random()*i); int temp=arr[i-1]; arr[i-1]=arr[r]; arr[r]=temp; } }
    }

    public static void main(String[] args)throws IOException {
        /*
inputCopy
3
2
5 5
2 3
3
3 5
2 3
2 3
3
3 3
4 4
5 5
outputCopy
2 1
-1
1 1 2
        */
        PrintWriter pw = new PrintWriter(System.out);
        FastReader fr = new FastReader();
        int t=fr.i();
        for(int ti=0;ti<t;++ti)
        {
           int q=fr.i();
           Node [] nodeArr=new Node[q];
           PriorityQueue<Node> pq=new PriorityQueue<>();
           for(int qi=0;qi<q;++qi)
           {
               int start=fr.i();
               int end=fr.i();
               Node node=new Node(qi,start,end);
               nodeArr[qi]=node;
               pq.add(node);
           }
           boolean second=false;
           Node n=pq.remove();
           int end=n.end;
           n.group=1;
           for(int qi=1;qi<q;++qi)
           {
               Node node=pq.remove();
               if(node.start>end)
               {
                   second=true;
               }
               end=Math.max(end,node.end);
               if(second)
               {
                   node.group=2;
               }
               else
               {
                   node.group=1;
               }
           }
           if(!second)
           {
               pw.println(-1);
           }
           else
           {
               for(Node node: nodeArr)
                   pw.print(node.group+" ");
               pw.println();
           }
        }
        pw.flush();
        pw.close();
    }
    static class Node implements Comparable<Node>
    {
        int start;
        int end;
        int index;
        int group;
        Node(int i,int s,int e)
        {
            index=i;
            start=s;
            end=e;
            group=-1;
        }
        @Override
        public int compareTo(Node other)
        {
            return Integer.compare(this.start,other.start);
        }
    }
}