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.*;

public class Sol {
	 static class FastReader 
	    { 
	        final private int BUFFER_SIZE = 1 << 16; 
	        private DataInputStream din; 
	        private byte[] buffer; 
	        private int bufferPointer, bytesRead; 
	  
	        public FastReader() 
	        { 
	            din = new DataInputStream(System.in); 
	            buffer = new byte[BUFFER_SIZE]; 
	            bufferPointer = bytesRead = 0; 
	        } 
	  
	        public FastReader(String file_name) throws IOException 
	        { 
	            din = new DataInputStream(new FileInputStream(file_name)); 
	            buffer = new byte[BUFFER_SIZE]; 
	            bufferPointer = bytesRead = 0; 
	        } 
	  
	        public String nextLine() throws IOException 
	        { 
	            byte[] buf = new byte[64]; // line length 
	            int cnt = 0, c; 
	            while ((c = read()) != -1) 
	            { 
	                if (c == '\n') 
	                    break; 
	                buf[cnt++] = (byte) c; 
	            } 
	            return new String(buf, 0, cnt); 
	        } 
	  
	        public int nextInt() throws IOException 
	        { 
	            int ret = 0; 
	            byte c = read(); 
	            while (c <= ' ') 
	                c = read(); 
	            boolean neg = (c == '-'); 
	            if (neg) 
	                c = read(); 
	            do
	            { 
	                ret = ret * 10 + c - '0'; 
	            }  while ((c = read()) >= '0' && c <= '9'); 
	  
	            if (neg) 
	                return -ret; 
	            return ret; 
	        } 
	  
	        public long nextLong() throws IOException 
	        { 
	            long ret = 0; 
	            byte c = read(); 
	            while (c <= ' ') 
	                c = read(); 
	            boolean neg = (c == '-'); 
	            if (neg) 
	                c = read(); 
	            do { 
	                ret = ret * 10 + c - '0'; 
	            } 
	            while ((c = read()) >= '0' && c <= '9'); 
	            if (neg) 
	                return -ret; 
	            return ret; 
	        } 
	  
	        public double nextDouble() throws IOException 
	        { 
	            double ret = 0, div = 1; 
	            byte c = read(); 
	            while (c <= ' ') 
	                c = read(); 
	            boolean neg = (c == '-'); 
	            if (neg) 
	                c = read(); 
	  
	            do { 
	                ret = ret * 10 + c - '0'; 
	            } 
	            while ((c = read()) >= '0' && c <= '9'); 
	  
	            if (c == '.') 
	            { 
	                while ((c = read()) >= '0' && c <= '9') 
	                { 
	                    ret += (c - '0') / (div *= 10); 
	                } 
	            } 
	  
	            if (neg) 
	                return -ret; 
	            return ret; 
	        } 
	  
	        private void fillBuffer() throws IOException 
	        { 
	            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE); 
	            if (bytesRead == -1) 
	                buffer[0] = -1; 
	        } 
	  
	        private byte read() throws IOException 
	        { 
	            if (bufferPointer == bytesRead) 
	                fillBuffer(); 
	            return buffer[bufferPointer++]; 
	        } 
	  
	        public void close() throws IOException 
	        { 
	            if (din == null) 
	                return; 
	            din.close(); 
	        } 
	    } 
	  
	public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
	static final long mod = (long)(1e9+7);
	
	//static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) throws IOException {
		FastReader sc = new FastReader();
		// TODO Auto-generated method stub
		
		int t = sc.nextInt();
		while(t-->0) {
			
			int n = sc.nextInt();
			int[] ans = new int[n];
			Pair[] p = new Pair[n];
			Map<Pair,Integer> map = new HashMap<>();
			for(int i=0;i<n;++i) {
			int x = sc.nextInt();
			int y = sc.nextInt();
			p[i] = new Pair(x,y);
			if(!map.containsKey(p[i]))
			map.put(p[i], i);
		}
			Pair[] copy = p.clone();
			Arrays.sort(p,new Comparator<Pair>() {

				@Override
				public int compare(Pair o1, Pair o2) {
				    if(o1.x == o2.x) return o1.y-o2.y;
					return o1.x-o2.x;
				}
				
			});
			//for(Pair x : copy) out.println(x.x+" "+x.y);
			int l1 = p[0].x,r1 = p[0].y,l2=-1,r2 = -1;
			
			//ans[map.get(p[0])] = 1;
			for(int i=0;i<n;++i) {
				
			    int l = p[i].x;
			    int r = p[i].y;
			    if(l1<=l && r1>= l) {
			    	r1 = Math.max(r1, r);
			    	ans[map.get(p[i])] = 1;
			    }else {
			    	ans[map.get(p[i])] = 2;
			    }
			}
			
			
				boolean one = false,two = false;
				
				for(int i=0;i<n;++i) {
					if(ans[i] == 0) {
						
						ans[i] = ans[map.get(copy[i])];
					
					}
					if(ans[i] == 1) one = true;
					else if(ans[i] == 2) two = true;
				}
			
				if(one && two) {
					for(int x : ans) out.print(x+" ");
					out.println();
				}else out.println(-1);
			
		}

		
		out.close();
	}
	
	 static class Pair{
	    	int x;
	    	int y;
	    	Pair(int x,int y){
	    		this.x=x;
	    		this.y=y;
	    	}
	    	@Override
	        public int hashCode() {
	            final int prime = 31;
	           int  result = prime * x + y; 
	            return result;
	        }
	    	
	    	 @Override
	    	    public boolean equals(Object obj) {
	    	        if (this == obj)
	    	            return true;
	    	        if (obj == null)
	    	            return false;
	    	        if (getClass() != obj.getClass())
	    	            return false;
	    	        Pair other = (Pair) obj;
	    	        if (x != other.x && y != other.y)
	    	            return false;
	    	        return true;
	    	    }
	    	
	    }
	

	
}