Problem: You are given n sets of integers. The i-th set contains k_i integers.

Two sets are called similar if they share at least two common elements, i. e. there exist two integers x and y such that x ≠ y, and they both belong to each of the two sets.

Your task is to find two similar sets among the given ones, or report that there is no such pair of sets.

Input

The first line contains a single integer t (1 ≤ t ≤ 50000) — the number of test cases. Then t test cases follow.

The first line of each test case contains a single integer n (2 ≤ n ≤ 10^5) the number of given sets. The following n lines describe the sets. The i-th line starts with an integer k_i (2 ≤ k_i ≤ 10^5) — the number of integers in the i-th set. Then k_i integers a_{i,1}, a_{i,2}, ..., a_{i,k_i} (1 ≤ a_{i,j} ≤ 10^9) follow — the elements of the i-th set. It is guaranteed that all elements in each set are different.

The total number of elements in all sets in all test cases is not greater than 2⋅ 10^5.

Output

For each test case, print the answer on a single line. 

If there is no pair of similar sets, print -1. 

Otherwise, print two different integers — the indices of the similar sets. The sets are numbered from 1 to n in the order they are given in the input. If there are multiple answers, print any of them.

Example

Input


3
4
2 1 10
3 1 3 5
5 5 4 3 2 1
3 10 20 30
3
4 1 2 3 4
4 2 3 4 5
4 3 4 5 6
2
3 1 3 5
3 4 3 2


Output


2 3 
1 2 
-1

Solution (in JAVA):

Solution:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.util.HashMap;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskM solver = new TaskM();
        int testCount = Integer.parseInt(in.next());
        for (int i = 1; i <= testCount; i++)
            solver.solve(i, in, out);
        out.close();
    }

    static class TaskM {
        static final int E = 250;

        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int n = in.nextInt();
            ArrayList<Integer> u = new ArrayList<>(), v = new ArrayList<>();
            int id = n;
            HashMap<Integer, Integer> map = new HashMap<>();
            for (int i = 0; i < n; i++) {
                int k = in.nextInt();
                for (int j = 0; j < k; j++) {
                    u.add(i);
                    int x = in.nextInt();
                    if (map.containsKey(x)) {
                        v.add(map.get(x));
                    } else {
                        v.add(id);
                        map.put(x, id);
                        id++;
                    }
                }
            }
            List<Integer>[] g = Stream.generate(ArrayList::new).limit(id).toArray(List[]::new);
            for (int i = 0; i < u.size(); i++) {
                g[u.get(i)].add(v.get(i));
                g[v.get(i)].add(u.get(i));
            }

            int[] visited = new int[id];
            int[] parent = new int[id];
            for (int i = 0; i < n; i++)
                if (g[i].size() > E) {
                    for (int j : g[i]) {
                        for (int k : g[j])
                            if (k != i) {
                                if (visited[k] == i + 1) {
                                    out.println((i + 1) + " " + (k + 1));
                                    return;
                                }
                                visited[k] = i + 1;
                            }
                    }
                }
            for (int i = n; i < id; i++)
                if (g[i].size() > E) {
                    for (int j : g[i]) {
                        for (int k : g[j])
                            if (k != i) {
                                if (visited[k] == i + 1) {
                                    out.println((j + 1) + " " + (parent[k] + 1));
                                    return;
                                }
                                visited[k] = i + 1;
                                parent[k] = j;
                            }
                    }
                }

            Arrays.fill(visited, 0);
            for (int i = 0; i < n; i++)
                if (g[i].size() <= E) {
                    for (int j : g[i])
                        if (g[j].size() <= E) {
                            for (int k : g[j])
                                if (k != i) {
                                    if (visited[k] == i + 1) {
                                        out.println((i + 1) + " " + (k + 1));
                                        return;
                                    }
                                    visited[k] = i + 1;
                                }
                        }
                }

            out.println(-1);
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void println(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
            writer.print('\n');
        }

        public void close() {
            writer.close();
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

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

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

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public String next() {
            int c;
            while (isSpaceChar(c = this.read())) {
                ;
            }

            StringBuilder result = new StringBuilder();
            result.appendCodePoint(c);

            while (!isSpaceChar(c = this.read())) {
                result.appendCodePoint(c);
            }

            return result.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

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

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}