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:
// Working program using Reader Class 
import java.io.DataInputStream; 
import java.io.FileInputStream; 
import java.io.IOException; 
import java.io.InputStreamReader; 
import java.util.*; 
import java.util.StringTokenizer; 

public class Main 
{ 
	static class Reader 
	{ 
		final private int BUFFER_SIZE = 1 << 16; 
		private DataInputStream din; 
		private byte[] buffer; 
		private int bufferPointer, bytesRead; 

		public Reader() 
		{ 
			din = new DataInputStream(System.in); 
			buffer = new byte[BUFFER_SIZE]; 
			bufferPointer = bytesRead = 0; 
		} 

		public Reader(String file_name) throws IOException 
		{ 
			din = new DataInputStream(new FileInputStream(file_name)); 
			buffer = new byte[BUFFER_SIZE]; 
			bufferPointer = bytesRead = 0; 
		} 

		public String readLine() 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 int done=0;
	
	public static void checkc(int[] a,int i,int sum) {
		sum+=a[i];
		if(i==a.length-1) {
			//sum+=a[i];
			if(sum==0 || sum==360) {
				done=1;
			}
		}
		else {
			checkc(a,i+1,sum);
			checka(a,i+1,sum);
		}
	}
	
	public static void checka(int[] a,int i,int sum) {
		sum-=a[i];
		if(i==a.length-1) {
			//sum-=a[i];
			if(sum==0 || sum==360) {
				done=1;
			}
		}
		else {
			checkc(a,i+1,sum);
			checka(a,i+1,sum);
		}
	}
	
	public static class Node implements Comparable<Node>{
		//HashSet<Integer> hs=new HashSet<Integer>();
		int l=0;
		int r=0;
		int ind=0;
		Node(int li,int ri,int i){
			l=li;
			r=ri;
			ind=i;
		}
		public int compareTo(Node n) {
			return this.l-n.l;
		}
	}

	public static void main(String[] args) throws IOException 
	{ 
		Reader scan=new Reader(); 
		int test=scan.nextInt();
		for(int t=0;t<test;t++) {
			int n=scan.nextInt();
			ArrayList<Node> nd=new ArrayList<Node>();
			int[] ans=new int[n];
			int done2=0;
			for(int i=0;i<n;i++) {
				int l=scan.nextInt();
				int r=scan.nextInt();
				nd.add(new Node(l,r,i));
			}
			Collections.sort(nd);
			int left1=-1;
			int right1=-1;
			int left2=-1;
			int right2=-1;
			int curr=1;
			for(int i=0;i<n;i++) {
				if(i==0) {
					left1=nd.get(i).l;
					right1=nd.get(i).r;
					ans[nd.get(i).ind]=1;
				}
				else {
					if(curr==1) {
						if(nd.get(i).l<=right1) {
							ans[nd.get(i).ind]=1;
							right1=Math.max(right1, nd.get(i).r);
						}
						else {
							curr=2;
							done2=1;
							ans[nd.get(i).ind]=2;
							right2=nd.get(i).r;
						}
					}
					else {
						if(nd.get(i).l<=right2) {
							ans[nd.get(i).ind]=2;
							right2=Math.max(right2, nd.get(i).r);
						}
						else {
							curr=1;
							//done2=1;
							ans[nd.get(i).ind]=1;
							right1=nd.get(i).r;
						}
					}
				}
			}
			if(done2==0) {
				System.out.println(-1);
			}
			else {
				for(int i=0;i<n;i++) {
					System.out.print(ans[i] + " ");
				}
				System.out.println();
			}
		}
	} 
}