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.*;
import java.util.Collections;
import java.util.PriorityQueue;
public class icpc{
    private static void quick(int lower,int higher,int[][] arr)
{
    int i=lower;
    int j=higher;
    int pivot=arr[lower+(higher-lower)/2][0];
    while(i<=j)
    {
        while(arr[i][0]<pivot)
        i++;
        while(arr[j][0]>pivot)
        j--;
        if(i<=j)
        {
            exchangenumber(i,j,arr);
            i++;
            j--;
        }
    }
    if(lower<j)
        quick(lower,j,arr);
    if(higher>i)
        quick(i,higher,arr);
}
public static void exchangenumber(int i,int j,int[][] arr)
{
    //System.out.println(i+" "+j);
    int x=arr[i][2];
    int y=arr[i][0];
    int z=arr[i][1];
    arr[i][0]=arr[j][0];
    arr[i][1]=arr[j][1];
    arr[i][2]=arr[j][2];
    arr[j][2]=x;
    arr[j][0]=y;
    arr[j][1]=z;
}
public static void main(String[] args)throws IOException {
    FastReader in=new FastReader(System.in);
    StringBuilder sb=new StringBuilder();
    int i,j;
    int t=in.nextInt();
    while(t-->0)
    {
        int n=in.nextInt();
        int f=0,f1=0,val,max,temp=-1;
        int arr[][]=new int[n][3];
        int bool[]=new int[n];
        int pos[]=new int[n];
        for(i=0;i<n;i++)
        {
            arr[i][0]=in.nextInt();
            arr[i][1]=in.nextInt();
        }
        for(i=0;i<n;i++)
            arr[i][2]=i;
         quick(0,n-1,arr);
         /*for(i=0;i<n;i++)
             System.out.print(arr[i][2]+" ");
         System.out.println();*/
         max=arr[0][1];
         for(i=1;i<n;i++)
         {
             if(arr[i][0]>max)
             {
                 f=1;
                 temp=i-1;
                 break;
             }
             max=(int)Math.max(max,arr[i][1]);
         }
         if(f==0)
         {
             sb.append("-1").append("\n");
             continue;
         }
         for(i=0;i<n;i++)
         {
             if(i<=temp)
                 bool[i]=1;
             else
                 bool[i]=2;
         }
         for(i=0;i<n;i++)
         {
             pos[arr[i][2]]=bool[i];
         }
         for(i=0;i<n;i++)
             sb.append(pos[i]).append(" ");
         sb.append("\n");
    }  
    System.out.println(sb);
   }
}
class FastReader {
 
    byte[] buf = new byte[2048];
    int index, total;
    InputStream in;
 
    FastReader(InputStream is) {
        in = is;
    }
 
    int scan() throws IOException {
        if (index >= total) {
            index = 0;
            total = in.read(buf);
            if (total <= 0) {
                return -1;
            }
        }
        return buf[index++];
    }
 
    String next() throws IOException {
        int c;
        for (c = scan(); c <= 32; c = scan());
        StringBuilder sb = new StringBuilder();
        for (; c > 32; c = scan()) {
            sb.append((char) c);
        }
        return sb.toString();
    }
    String nextLine() throws IOException {
        int c;
        for (c = scan(); c <= 32; c = scan());
        StringBuilder sb = new StringBuilder();
        for (; c !=10 && c!=13; c = scan()) {
            sb.append((char) c);
        }
        return sb.toString();
    }
    char nextChar() throws IOException{
        int c;
         for (c = scan(); c <= 32; c = scan());
         return (char)c;
        }
 
    int nextInt() throws IOException {
        int c, val = 0;
        for (c = scan(); c <= 32; c = scan());
        boolean neg = c == '-';
        if (c == '-' || c == '+') {
            c = scan();
        }
        for (; c >= '0' && c <= '9'; c = scan()) {
            val = (val << 3) + (val << 1) + (c & 15);
        }
        return neg ? -val : val;
    }
 
    long nextLong() throws IOException {
        int c;
        long val = 0;
        for (c = scan(); c <= 32; c = scan());
        boolean neg = c == '-';
        if (c == '-' || c == '+') {
            c = scan();
        }
        for (; c >= '0' && c <= '9'; c = scan()) {
            val = (val << 3) + (val << 1) + (c & 15);
        }
        return neg ? -val : val;
    }
}