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 Q2 {

    public static void main(String[] args) {

        InputReader in = new InputReader();

        int q = in.nextInt();

        while (q-- > 0) {

            int N = in.nextInt();
            int arr[][] = new int[N][3];
            int ans[] = new int[N];

            for (int i = 0; i < N; i++) {
                arr[i][0] = in.nextInt();
                arr[i][1] = in.nextInt();
                arr[i][2]=i;
            }

            Arrays.sort(arr, (o1, o2) -> (o1[0] - o2[0]) != 0 ? o1[0] - o2[0] : o1[1] - o2[1]);

            ans[arr[0][2]]=1;
            int e1 = arr[0][1],s1=arr[0][0], e2 = 0,s2=0;
            for (int i = 1; i < N; i++) {
                int l = arr[i][0], r = arr[i][1],pos=arr[i][2];

                if(l>=s1 && l<=e1 ){
                    e1=Math.max(r,e1);
                    ans[pos]=1;
                }else if(s2==0){
                    s2=l; e2=r;
                    ans[pos]=2;
                }else{
                    e2=Math.max(r,e2);
                    ans[pos]=2;
                }
            }

            if (e1 == 0 || e2 == 0)
                System.out.println(-1);
            else {
                for (int i = 0; i < N; i++)
                    System.out.print(ans[i] + " ");
                System.out.println();
            }
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader() {
            reader = new BufferedReader(new InputStreamReader(System.in), 32768);
            tokenizer = null;
        }

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(System.in), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public char nextChar() {
            return next().charAt(0);
        }

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

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

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

        public int[] nextIntArr(int n) {
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] = this.nextInt();
            }
            return arr;
        }

        public Integer[] nextIntegerArr(int n) {
            Integer[] arr = new Integer[n];
            for (int i = 0; i < n; i++)
                arr[i] = new Integer(this.nextInt());

            return arr;
        }

        public int[][] next2DIntArr(int n, int m) {
            int[][] arr = new int[n][m];
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < m; j++) {
                    arr[i][j] = this.nextInt();
                }
            }
            return arr;
        }

        public int[] nextSortedIntArr(int n) {
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] = this.nextInt();
            }
            Arrays.sort(arr);
            return arr;
        }

        public long[] nextLongArr(int n) {
            long[] arr = new long[n];
            for (int i = 0; i < n; i++) {
                arr[i] = this.nextLong();
            }
            return arr;
        }

        public char[] nextCharArr(int n) {
            char[] arr = new char[n];
            for (int i = 0; i < n; i++) {
                arr[i] = this.nextChar();
            }
            return arr;
        }


        public static int gcd(int a, int b) {
            return b == 0 ? a : gcd(b, a % b);
        }

        public static int[] uwiSieve(int n) {
            if (n <= 32) {
                int[] primes = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31};
                for (int i = 0; i < primes.length; i++) {
                    if (n < primes[i]) {
                        return Arrays.copyOf(primes, i);
                    }
                }
                return primes;
            }

            int u = n + 32;
            double lu = Math.log(u);
            int[] ret = new int[(int) (u / lu + u / lu / lu * 1.5)];
            ret[0] = 2;
            int pos = 1;

            int[] isp = new int[(n + 1) / 32 / 2 + 1];
            int sup = (n + 1) / 32 / 2 + 1;

            int[] tprimes = {3, 5, 7, 11, 13, 17, 19, 23, 29, 31};
            for (int tp : tprimes) {
                ret[pos++] = tp;
                int[] ptn = new int[tp];
                for (int i = (tp - 3) / 2; i < tp << 5; i += tp)
                    ptn[i >> 5] |= 1 << (i & 31);
                for (int i = 0; i < tp; i++) {
                    for (int j = i; j < sup; j += tp)
                        isp[j] |= ptn[i];
                }
            }

            // 3,5,7
            // 2x+3=n
            int[] magic = {0, 1, 23, 2, 29, 24, 19, 3, 30, 27, 25, 11, 20, 8, 4, 13, 31, 22, 28, 18, 26, 10, 7, 12, 21, 17,
                    9, 6, 16, 5, 15, 14};
            int h = n / 2;
            for (int i = 0; i < sup; i++) {
                for (int j = ~isp[i]; j != 0; j &= j - 1) {
                    int pp = i << 5 | magic[(j & -j) * 0x076be629 >>> 27];
                    int p = 2 * pp + 3;
                    if (p > n)
                        break;
                    ret[pos++] = p;
                    for (int q = pp; q <= h; q += p)
                        isp[q >> 5] |= 1 << (q & 31);
                }
            }

            return Arrays.copyOf(ret, pos);
        }

        public static int[] radixSort(int[] f) {
            return radixSort(f, f.length);
        }

        public static int[] radixSort(int[] f, int n) {
            int[] to = new int[n];
            {
                int[] b = new int[65537];
                for (int i = 0; i < n; i++) b[1 + (f[i] & 0xffff)]++;
                for (int i = 1; i <= 65536; i++) b[i] += b[i - 1];
                for (int i = 0; i < n; i++) to[b[f[i] & 0xffff]++] = f[i];
                int[] d = f;
                f = to;
                to = d;
            }
            {
                int[] b = new int[65537];
                for (int i = 0; i < n; i++) b[1 + (f[i] >>> 16)]++;
                for (int i = 1; i <= 65536; i++) b[i] += b[i - 1];
                for (int i = 0; i < n; i++) to[b[f[i] >>> 16]++] = f[i];
                int[] d = f;
                f = to;
                to = d;
            }
            return f;
        }
    }

}