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.awt.font.NumericShaper.Range;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collections;

public class C {

	class Range implements Comparable<Range> {
		int id;
		int l, r;
		Range(int i, int ll, int rr) { id = i; l = ll; r = rr; }
		public int compareTo(Range o) {
			return l - o.l;
		}
		public String toString() {
			return String.format("(%d %d)", l, r);
		}
	}
	
	void merge(ArrayList<Range> ranges) {
		ArrayDeque<Range> q = new ArrayDeque<>();
		q.addLast(ranges.get(0));
		for(int i = 1; i < ranges.size(); ++i) {
			Range cur = ranges.get(i);
			Range prev = q.pollLast();
			if(prev.r >= cur.l) {
				int min = Math.min(cur.l, prev.l);
				int max = Math.max(cur.r, prev.r);
				prev.l = cur.l = min;
				prev.r = cur.r = max;
			}
			q.add(prev);
			q.add(cur);
		}
		ranges.clear();
		ranges.addAll(q);
	}
	
	public void solve(JS in, PrintWriter out) {
		int q = in.nextInt();
		while(q-->0) {
			int n = in.nextInt();
			ArrayList<Range> ranges = new ArrayList<>();
			for(int i = 0; i < n; ++i) {
				int l = in.nextInt(), r = in.nextInt();
				ranges.add(new Range(i, l, r));
			}
			Collections.sort(ranges);
			merge(ranges);
//			System.out.println(ranges);
			int intersects = -1;
			for(int i = 0; i < n - 1; ++i) {
				if(ranges.get(i).r < ranges.get(i + 1).l) {
					intersects = i;
					break;
				}
			}
			if(intersects == -1) {
				out.println(-1);
				continue;
			}
			int[] ans = new int[n];
			for(int i = 0; i <= intersects; ++i) {
				ans[ranges.get(i).id] = 1;
			}
			for(int i = intersects + 1; i < n; ++i) {
				ans[ranges.get(i).id] = 2;
			}
			for(int i = 0; i < n; ++i) out.print(ans[i] + " ");
			out.println();
		}
		
	}
	
	public static void main(String[] args) {
		JS in = new JS();
		PrintWriter out = new PrintWriter(System.out);
		new C().solve(in, out);
		out.close();
	}
	
	static class JS {
		public int BS = 1<<16;
		public char NC = (char)0;
		byte[] buf = new byte[BS];
		int bId = 0, size = 0;
		char c = NC;
		double num = 1;
		BufferedInputStream in;

		public JS() {
			in = new BufferedInputStream(System.in, BS);
		}

		public JS(String s) throws FileNotFoundException {
			in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
		}

		public char nextChar(){
			while(bId==size) {
				try {
					size = in.read(buf);
				}catch(Exception e) {
					return NC;
				}
				if(size==-1)return NC;
				bId=0;
			}
			return (char)buf[bId++];
		}

		public int nextInt() {
			return (int)nextLong();
		}

		public long nextLong() {
			num=1;
			boolean neg = false;
			if(c==NC)c=nextChar();
			for(;(c<'0' || c>'9'); c = nextChar()) {
				if(c=='-')neg=true;
			}
			long res = 0;
			for(; c>='0' && c <='9'; c=nextChar()) {
				res = (res<<3)+(res<<1)+c-'0';
				num*=10;
			}
			return neg?-res:res;
		}

		public double nextDouble() {
			double cur = nextLong();
			return c!='.' ? cur:cur+nextLong()/num;
		}

		public String next() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c>32) {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public String nextLine() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c!='\n') {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public boolean hasNext() {
			if(c>32)return true;
			while(true) {
				c=nextChar();
				if(c==NC)return false;
				else if(c>32)return true;
			}
		}
	}
}