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.*;
import java.util.*;

public class Main{
    public static void main(String[] args) throws Exception {
        new Main();
    }
    Main() throws Exception{
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        int t=in.nextInt();
        while(t--!=0){
            int n=in.nextInt(),ra=-1,rb=-1;
            Segment[]a=new Segment[n];
            for(int i=0;i<n;i++)
                a[i]=new Segment(in.nextInt(),in.nextInt(),i);
            Arrays.sort(a);
            boolean f=false;
            ra=a[0].r;a[0].belong=1;
            for(int i=1;i<n&&!f;i++){
                if(ra>=a[i].l&&rb!=-1&&rb>=a[i].l)f=true;
                else if(ra>=a[i].l){
                    ra=Math.max(ra,a[i].r);
                    a[i].belong=1;
                }else if(rb>=a[i].l||rb==-1){
                    rb=Math.max(rb,a[i].r);
                    a[i].belong=2;
                }else {
                    ra=Math.max(ra,a[i].r);
                    a[i].belong=1;
                }
            }
            if(f||rb==-1)out.println(-1);
            else {
                Arrays.sort(a,Comparator.comparingInt(x->x.id));
                for(int i=0;i<n-1;i++)out.print(a[i].belong+" ");
                out.println(a[n-1].belong);
            }
        }
        out.flush();
    }
}
class Segment implements Comparable<Segment>{
    int id,l,r,belong;
    Segment(int l,int r,int id){
        this.l=l;
        this.r=r;
        this.id=id;
    }

    @Override
    public int compareTo(Segment o) {
        if(l==o.l)return r-o.r;
        return l-o.l;
    }
}
class InputReader {
    private InputStreamReader reader;
    private char[] buf;
    private int len, now;

    public InputReader(InputStream stream) {
        reader = new InputStreamReader(stream);
        buf = new char[1024];
        len = 0;
        now = 0;
    }

    public String next() throws IOException {
        if (!hasNext()) throw new NullPointerException();
        StringBuilder sb = new StringBuilder();
        while (!isSpaceChar(buf[now])) {
            sb.append(buf[now]);
            if (!move()) break;
        }
        return sb.toString();
    }

    public int nextInt() throws IOException {
        if (!hasNext()) throw new NullPointerException();
        boolean x = false;
        if (buf[now] == '-') {
            x = true;
            if (!move()) throw new NumberFormatException();
        }
        int ans = 0;
        while (!isSpaceChar(buf[now])) {
            if (isNum(buf[now])) ans = ans * 10 + buf[now] - '0';
            else throw new NumberFormatException();
            if (!move()) break;
        }
        return (x ? -1 : 1) * ans;
    }

    public String nextLine() throws IOException {
        if (!hasNextLine()) throw new NullPointerException();
        StringBuilder sb = new StringBuilder();
        while (buf[now] != '\n') {
            sb.append(buf[now]);
            if (!move()) return sb.toString();
        }
        now++;
        return sb.toString();
    }

    public long nextLong() throws IOException {
        if (!hasNext()) throw new NullPointerException();
        boolean x = false;
        if (buf[now] == '-') {
            x = true;
            if (!move()) throw new NumberFormatException();
        }
        long ans = 0;
        while (!isSpaceChar(buf[now])) {
            if (isNum(buf[now])) ans = ans * 10 + buf[now] - '0';
            else throw new NumberFormatException();
            if (!move()) break;
        }
        return (x ? -1 : 1) * ans;
    }

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

    public int nextHexInt() throws IOException {
        if (!hasNext()) throw new NullPointerException();
        boolean x = false;
        if (buf[now] == '-') {
            x = true;
            if (!move()) throw new NumberFormatException();
        }
        int ans = 0;
        while (!isSpaceChar(buf[now])) {
            if (isHex(buf[now])) ans = ans * 16 + toHex(buf[now]);
            else throw new NumberFormatException();
            if (!move()) break;
        }
        return (x ? -1 : 1) * ans;
    }

    public char nextChar() throws IOException {
        if (!hasNext()) throw new NullPointerException();
        char tmp = buf[now];
        move();
        return tmp;
    }
    public int next(char[] s) throws IOException {
        if (!hasNext()) throw new NullPointerException();
        int len=0;
        while (!isSpaceChar(buf[now])&&len<s.length) {
            s[len++]=buf[now];
            if (!move()) break;
        }
        return len;
    }
    public boolean hasNext() throws IOException {
        return skip();
    }

    public boolean hasNextLine() throws IOException {
        return now < len || refill();
    }

    private boolean move() throws IOException {
        now++;
        return hasNextLine();
    }

    private boolean skip() throws IOException {
        if (!hasNextLine()) return false;
        while (isSpaceChar(buf[now])) {
            if (!move()) return false;
        }
        return true;
    }

    private boolean isSpaceChar(char c) {
        return !(c >= 33 && c <= 126);
    }

    private boolean isNum(char c) {
        return c >= '0' && c <= '9';
    }

    private boolean isHex(char c) {
        return c >= '0' && c <= '9' || c >= 'A' && c <= 'F';
    }

    private int toHex(char c) {
        if (c >= '0' && c <= '9') return c - '0';
        else return c - 'A' + 10;
    }

    private boolean refill() throws IOException {
        len = reader.read(buf);
        now = 0;
        return len > 0;
    }
}