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.util.*;
import java.io.*;
import java.lang.reflect.Array;

		public class codeforces
		{	
			public static void main(String[] args)
			{
				InputReader in = new InputReader(System.in);
				PrintWriter pw = new PrintWriter(System.out);

				int T = in.nextInt();
				int M = 0, n, l, r;
				
				while(T-- > 0)
				{
					n = in.nextInt();
					int[] a = new int[n];
					int[] b = new int[n];
					M = Integer.MIN_VALUE;
					
					TreeMap<Integer, Long> F = new TreeMap<>();
					TreeMap<Integer, Long> B = new TreeMap<>();
					HashMap<Integer, Integer> ans = new HashMap<>();
					
					for(int i=0;i<n;i++)
					{
						a[i] = in.nextInt();
						b[i] = in.nextInt();
						
						if(!F.containsKey(a[i]))
							F.put(a[i], 1L);
						else
							F.put(a[i], F.get(a[i])+1);
						
						if(!F.containsKey(b[i]))
							F.put(b[i], 0L);
						
						if(!B.containsKey(b[i]))
							B.put(b[i], -1L);
						else
							B.put(b[i], B.get(b[i])-1);
						
						if(!B.containsKey(a[i]))
							B.put(a[i], 0L);
					}
					
					M++;
					
					boolean one = false, two = false;
					int bi = 1;
					long sum = 0;
					
					for(int k : F.keySet())
					{
						sum += F.get(k);	
						F.put(k, sum);
					}
					
					sum = 0;
					
					for(int k : B.keySet())
					{
						sum += B.get(k);	
						B.put(k, sum);
					}
					
					for(int k : F.keySet())
					{
						if(F.get(k) + B.get(k) == 0)
						{
							ans.put(k, bi);
							
							if(bi == 1)
								one = true;
							else
								two = true;
							
							bi = bi%2 + 1;
						}
						else
							ans.put(k, bi);
					}
					
					if(one && two)
					{
						for(int i=0;i<n;i++)
							pw.print(ans.get(a[i])+" ");
					}
					else
						pw.print(-1);
				
					pw.println();
				}
				
				pw.flush();
				pw.close();
			}
			
		/*	public static void DFS(int sourse)
			{
				int count = 0;
				visited[sourse] = true;
				
				for(int u : adj[sourse])
				{
					if(!visited[u])
					{
						DFS(u);
					}
				}
				
				
			}*/
			
			public static ArrayList Divisors(long n)
			{
			    ArrayList<Long> div = new ArrayList<>();
			    
			    for (long i=1; i<=Math.sqrt(n); i++)
			    {
			        if (n%i == 0)
			        {
			        	div.add(i);
			                
			            if(n/i != i)
			            	div.add(n/i);
			        }
			    }
			    return div;
			}
		
			public static int BinarySearch(long[] a, long k)
			{
				int n = a.length;
				int i = 0, j = n-1;
				int mid = 0;
				
				if(k < a[0])
					return 0;
				else if(k >= a[n-1])
					return n;
				else
				{
					while(j - i > 1)
					{
						mid = (i+j)/2;
						
						if(k >= a[mid])
							i = mid;
						else
							j = mid;
					}
				}
				
				return i+1;
			}
			public static long GCD(long a,long b)
			{
				if(b==0)
					return a;
				else
					return GCD(b,a%b);
			}
			
			public static long LCM(long a,long b)
			{
				return (a*b)/GCD(a, b);
			}
			
			static class pair implements Comparable<pair>
			{
				Integer x, y;
				pair(int x,int y)
				{
					this.x=x;
					this.y=y;
				}
				
				public int compareTo(pair o) {
					int result = x.compareTo(o.x);
					if(result==0)
						result = y.compareTo(o.y);
					
					return result;
				}  
				
				public String toString()
				{
					return x+" "+y;
				}
				
				public boolean equals(Object o)
				{
					if (o instanceof pair)
				    {
						pair p = (pair)o;
						return p.x - x == 0 && p.y - y == 0 ;
					}
					return false;
				}
				
				public int hashCode()
				{
					return new Long(x).hashCode()*31 + new Long(y).hashCode();
				}
			}
			
			static class InputReader 
			{
				 
				private final InputStream stream;
				private final byte[] buf = new byte[8192];
				private int curChar, snumChars;
				private SpaceCharFilter filter;
		 
				public InputReader(InputStream stream) 
				{
					this.stream = stream;
				}
		 
				public int snext() 
				{
					if (snumChars == -1)
						throw new InputMismatchException();
					if (curChar >= snumChars) 
					{
						curChar = 0;
						try 
						{
							snumChars = stream.read(buf);
						} 
						catch (IOException e) 
						{
							throw new InputMismatchException();
						}
						if (snumChars <= 0)
							return -1;
					}
					return buf[curChar++];
				}
		 
				public int nextInt() 
			    {
					int c = snext();
					while (isSpaceChar(c)) 
					{
						c = snext();
					}
					int sgn = 1;
					if (c == '-')
				    {
						sgn = -1;
						c = snext();
					}
					int res = 0;
					do 
					{
						if (c < '0' || c > '9')
							throw new InputMismatchException();
						res *= 10;
						res += c - '0';
						c = snext();
					} while (!isSpaceChar(c));
					return res * sgn;
				}
		 
				public long nextLong()
			    {
					int c = snext();
					while (isSpaceChar(c)) 
					{
						c = snext();
					}
					int sgn = 1;
					if (c == '-') 
					{
						sgn = -1;
						c = snext();
					}
					long res = 0;
					do 
					{
						if (c < '0' || c > '9')
							throw new InputMismatchException();
						res *= 10;
						res += c - '0';
						c = snext();
					} while (!isSpaceChar(c));
					return res * sgn;
				}
		 
				public int[] nextIntArray(int n) 
				{
					int a[] = new int[n];
					for (int i = 0; i < n; i++) 
					{
						a[i] = nextInt();
					}
					return a;
				}
		 
				public String readString()
			    {
					int c = snext();
					while (isSpaceChar(c)) 
					{
						c = snext();
					}
					StringBuilder res = new StringBuilder();
					do 
					{
						res.appendCodePoint(c);
						c = snext();
					} while (!isSpaceChar(c));
					return res.toString();
				}
		 
				public String nextLine() 
				{
					int c = snext();
					while (isSpaceChar(c))
						c = snext();
					StringBuilder res = new StringBuilder();
					do 
					{
						res.appendCodePoint(c);
						c = snext();
					} while (!isEndOfLine(c));
					return res.toString();
				}
		 
				public boolean isSpaceChar(int c) 
				{
					if (filter != null)
						return filter.isSpaceChar(c);
					return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
				}
		 
				private boolean isEndOfLine(int c) 
				{
					return c == '\n' || c == '\r' || c == -1;
				}
		 
				public interface SpaceCharFilter
			    {
					public boolean isSpaceChar(int ch);
				}
			}
			
			static class CodeX {
	        public static void sort(long arr[]) {
	            merge_sort(arr, 0, arr.length - 1);
	        }
	
	        private static void merge_sort(long A[], long start, long end) {
	            if (start < end) {
	                long mid = (start + end) / 2;
	                merge_sort(A, start, mid);
	                merge_sort(A, mid + 1, end);
	                merge(A, start, mid, end);
	            }
	
	        }
	
	        private static void merge(long A[], long start,long mid, long end) {
	            long p = start, q = mid + 1;
	            long Arr[] = new long[(int)(end - start + 1)];
	            long k = 0;
	
	            for (int i = (int)start; i <= end; i++) {
	                if (p > mid)
	                    Arr[(int)k++] = A[(int)q++];
	
	                else if (q > end)
	                    Arr[(int)k++] = A[(int)p++];
	
	                else if (A[(int)p] < A[(int)q])
	                    Arr[(int)k++] = A[(int)p++];
	
	                else
	                    Arr[(int)k++] = A[(int)q++];
	            }
	            for (int i = 0; i < k; i++) {
	                A[(int)start++] = Arr[i];
	            }
	
	        }
	
	    }
		}