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.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.InputMismatchException;
import java.util.TreeMap;
public class CEducation58 {

	public static void main(String[] args) {
		FastScanner in = new FastScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int T = in.nextInt();
		while(T --> 0) {
			int N = in.nextInt();
			Pair[] pairs = new Pair[N];
			TreeMap<Pair, Integer> map = new TreeMap<>();
//			Pair[] pairs2 = new Pair[N];
			for(int i = 0; i < N; i++) {
				int a = in.nextInt();
				int b = in.nextInt();
				Pair p = new Pair(a, b);
				pairs[i] = p;
				map.put(p, 2);
			}
			
			ArrayList<Pair> list = new ArrayList<>();
			for(Pair p : map.keySet())
				list.add(p);
			
//			int start = list.get(0).a;
			int stop = list.get(0).b;
			map.put(list.get(0), 1);
			for(int i = 1; i < list.size(); i++) {
				Pair p = list.get(i);
				if(p.a <= stop) {
					map.put(p, 1);
					stop = Math.max(p.b, stop);
				}
				else {
					break;
				}
			}
			
			boolean contains2 = false;
			for(Pair p : map.keySet()) {
				if(map.get(p) == 2) {
					contains2 = true;
					break;
				}
			}
			
			if(!contains2) {
				out.println(-1);
			}
			else {
				for(int i = 0; i < pairs.length-1; i++)
					out.print(map.get(pairs[i]) + " ");
				out.println(map.get(pairs[pairs.length-1]));
			}
		}
		
		out.close();
	}
	
	static class Pair implements Comparable<Pair> {
		int a; int b;
		
		public Pair(int x, int y) {
			a = x; b = y;
		}

		public int compareTo(Pair p2) {
			if(a < p2.a)
				return -1;
			if(a == p2.a) {
				if(b < p2.b)
					return -1;
				if(b == p2.b)
					return 0;
				return 1;
			}
			return 1;
		}
		
		public boolean equals(Object o) {
			if(!(o instanceof Pair))
				return false;
			Pair p2 = (Pair) o;
			return (a == p2.a && b == p2.b);
		}
		
		public int hashCode() {
			return (a + " " + b).hashCode();
		}
		
		public String toString() {
			return "(" + a + ", " +  b + ")";
		}
	}
	
	/**
	 * Source: Matt Fontaine
	 */
	static class FastScanner {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int chars;

		public FastScanner(InputStream stream) {
			this.stream = stream;
		}

		int read() {
			if (chars == -1)
				throw new InputMismatchException();
			if (curChar >= chars) {
				curChar = 0;
				try {
					chars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (chars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		boolean isEndline(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		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 String nextLine() {
			int c = read();
			while (isEndline(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndline(c));
			return res.toString();
		}
	}

}
/*
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 
*/