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.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
import java.util.TreeSet;


public class P1 {

public static void main(String[] args) throws IOException {
	FastScanner fs=new FastScanner(System.in);
	int k=fs.nextInt();
	for(int i=0;i<k;i++) {
		PriorityQueue<meepst> pst=new PriorityQueue<meepst>();
		PriorityQueue<meepen> pen=new PriorityQueue<meepen>();
		int j=fs.nextInt();
		int[] s=new int[j];
		Arrays.fill(s, 1);
		for(int z=0;z<j;z++) {
			int st=fs.nextInt();
			int en=fs.nextInt();
			pst.add(new meepst(st,en,z));
			pen.add(new meepen(st,en,z));
		}
		HashSet<Integer> tbr=new HashSet<Integer>();
		boolean works=true;
		int fp=1;
		int fin=-1;
		while(pst.size()!=0) {
			//System.out.println(tbr);
			if(pst.peek().st<=pen.peek().en) {
				meepst a=pst.remove();
				if(fin!=-1) {
					s[a.id]=s[fin];
				}
				else {
					s[a.id]=fp;
					fp=3-fp;
				}
				tbr.add(a.id);
				if(tbr.size()==1)
					for(Integer q:tbr)
						fin=q;
			}
			else {
				meepen a=pen.remove();
				tbr.remove(a.id);
				if(tbr.size()==0)
					fin=-1;
				if(tbr.size()==1)
					for(Integer q:tbr)
						fin=q;
			}
		}
		//System.out.println(tbr);
			boolean seen1=false;
			boolean seen2=false;
			StringBuilder st=new StringBuilder("");
			for(int z=0;z<j;z++) {
				if(s[z]==1)
					seen1=true;
				if(s[z]==2)
					seen2=true;
				st=st.append(s[z]+" ");
			}
			st.setLength(st.length()-1);
			if(!seen1||!seen2) {
				System.out.println("-1");
			}
			else
			System.out.println(st);
		}
	}


	//System.out.println(c[3]+" "+c[4]);
	
	


static class FastScanner {
    BufferedReader br;
    StringTokenizer st;
    public FastScanner(InputStream i){
        br = new BufferedReader(new InputStreamReader(i));
        st = new StringTokenizer("");
    }
    public String next() throws IOException{
        if(st.hasMoreTokens()) return st.nextToken();
        else st = new StringTokenizer(br.readLine());
        return next();
    }
    public long nextLong() throws IOException{ return Long.parseLong(next()); }
    public int nextInt() throws IOException { return Integer.parseInt(next()); }
    public double nextDouble() throws IOException { return Double.parseDouble(next()); }
    public String nextLine() throws IOException {
        if(!st.hasMoreTokens()) 
            return br.readLine();
        String ret = st.nextToken();
        while(st.hasMoreTokens()) 
            ret += " " + st.nextToken();
        return ret;
    }
}

}
class meepst implements Comparable{
int st,en,id;
public meepst(int st,int en,int id) {
	this.st=st;
	this.en=en;
	this.id=id;
}
@Override
public int hashCode() {
	final int prime = 31;
	int result = 1;
	result = prime * result + en;
	result = prime * result + id;
	result = prime * result + st;
	return result;
}
@Override
public boolean equals(Object obj) {
	if (this == obj)
		return true;
	if (obj == null)
		return false;
	if (getClass() != obj.getClass())
		return false;
	meepst other = (meepst) obj;
	if (en != other.en)
		return false;
	if (id != other.id)
		return false;
	if (st != other.st)
		return false;
	return true;
}
@Override
public int compareTo(Object o) {
	meepst a=(meepst)o;
	if(st==a.st) {
		if(en==a.en)
			return id-a.id;
		return en-a.en;
		}
	return st-a.st;
}
}
class meepen implements Comparable{
int st,en,id;
public meepen(int st,int en,int id) {
	this.st=st;
	this.en=en;
	this.id=id;
}
@Override
public int hashCode() {
	final int prime = 31;
	int result = 1;
	result = prime * result + en;
	result = prime * result + id;
	result = prime * result + st;
	return result;
}
@Override
public boolean equals(Object obj) {
	if (this == obj)
		return true;
	if (obj == null)
		return false;
	if (getClass() != obj.getClass())
		return false;
	meepst other = (meepst) obj;
	if (en != other.en)
		return false;
	if (id != other.id)
		return false;
	if (st != other.st)
		return false;
	return true;
}
@Override
public int compareTo(Object o) {
	meepen a=(meepen)o;
	if(en==a.en) {
		if(a.st==st)
			return id-a.id;
		return st-a.st;
		}
	return en-a.en;
}
}