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 CPP):

Solution:
/*
"0000000000000000000000000010101111110100000000000000000000000000",
"0000000000000000000000101110101010010111110000000000000000000000",
"0000000000000000000011101000100011010000100100000000000000000000",
"0000000000000000011110101011111000011110101110100000000000000000",
"0000000000000000110000001010000011110000101010110000000000000000",
"0000000000000010011011111011101110100101100010010100000000000000",
"0000000000000111001001000000101000111100110110110110000000000000",
"0000000000011111101101101110111011100001100100100011100000000000",
"0000000000111111111111000010000010001011001101101001110000000000",
"0000000001111111111111111111101111111001111001111111111000000000",
"0000000011111111111111111111111111111111111111111111111100000000",
"0000000111111111111111111111111111111111111111111111111110000000",
"0000000111111111111111111111111111111111111111111111111110000000",
"0000001111111111111111111111111111111111111111111111111111000000",
"0000011111111111111111111111111111111111111111111111111111100000",
"0000011111111111111111111111111111111111111111111111111111100000",
"0000111111111111111111111111111111111111111111111111111111110000",
"0001111111111111111111111111111111111111111111111111111111111000",
"0000011111111111111111111111111111111111111111111111111111111000",
"0000000111111111111000100111111111111110001010111111111111100000",
"0011000001111111110010001111111111111110100000001111111100000000",
"0011110000011111000110100011111111111111101101100101100000001100",
"0111111100000100011100111001111111111101001000110000000001111110",
"0111111111000001001001101100011111111101101111100100001111111110",
"0111111111111011011100000111001111111000100100001110111111111110",
"0111111111000001000111011100011111111010111110100010010111111110",
"1111111111110111010010010001001111110010010000110111000111111111",
"1111111111100010010110111011101111010111011110011100010111111111",
"1111111111101111110111100001001010000101001011110001110111111111",
"1111111111100000100100111011100010101101101001000100100111111111",
"1111111111110110111101101110001011100000111101011111101111111111",
"1111111111100011100100100011101001110111100101110001000111111111",
"1111111111111000001101110110111011000001001101100100010111111111",
"1111111111111101101000010100001010010101101000110110111111111111",
"1111111111110000111101010101011110110100101110011100011111111111",
"1111111111111010010001110001111000100110000100110001111111111111",
"1111111111111111000111000101101101101100101110100100111111111111",
"1111111111111111110001011111100000111111100010001111111111111111",
"0111111111111111100100001111101011111111111000100111111111111110",
"0111111111111111111111111111111000011111111111111111111111111110",
"0111111111111111111111111111010010111111111111111111111111111110",
"0111111111111111111111111101000111111111111111111111111111111110",
"0011111111111111111111111100010001111111111111111111111111111100",
"0011111110011111111111111111110111111111111111111111111111111100",
"0001111111010111111111111111100011111111111111111111101111111000",
"0001111111000100011111111111001011111111111011111010000111111000",
"0001111111010101001011100101011001010010110001100000101111111000",
"0000111111110001100000100000001100011000000101001110111111110000",
"0000011111110100111101111011100111000011101111101011111111100000",
"0000011111111110100100100010111101110110100000100011111111100000",
"0000001111111100001101101000010001010000111010001111111111000000",
"0000000111111111011000111110110101000101100011111111111110000000",
"0000000111111111001110010100011100010111001000111111111110000000",
"0000000011111111100011110001110110111101111011111111111100000000",
"0000000001111111110110000101000000100001011111111111111000000000",
"0000000000111111111111010111101101101011001111111111110000000000",
"0000000000011111111111110000111100001000011111111111100000000000",
"0000000000000111111111111111111110111111111111111110000000000000",
"0000000000000011111111111111111111111111111111111100000000000000",
"0000000000000000111111111111111111111111111111110000000000000000",
"0000000000000000011111111111111111111111111111100000000000000000",
"0000000000000000000011111111111111111111111100000000000000000000",
"0000000000000000000000111111111111111111110000000000000000000000",
"0000000000000000000000000011111111111100000000000000000000000000"
IT'S SHOWTIME
HEY CHRISTMAS TREE N
YOU SET US UP 1
HEY CHRISTMAS TREE A
YOU SET US UP 1
HEY CHRISTMAS TREE B
YOU SET US UP 1
HEY CHRISTMAS TREE ANS
YOU SET US UP 1
HEY CHRISTMAS TREE I
YOU SET US UP 1
HEY CHRISTMAS TREE FLAG
YOU SET US UP 1

GET YOUR ASS TO MARS N
DO IT NOW
I WANT TO ASK YOU A BUNCH OF QUESTIONS AND I WANT TO HAVE THEM ANSWERED IMMEDIATELY

GET TO THE CHOPPER A
HERE IS MY INVITATION N
HE HAD TO SPLIT 1000
ENOUGH TALK

GET TO THE CHOPPER B
HERE IS MY INVITATION N
I LET HIM GO 1000
ENOUGH TALK

GET TO THE CHOPPER ANS
HERE IS MY INVITATION 1
ENOUGH TALK

GET TO THE CHOPPER I
HERE IS MY INVITATION A
ENOUGH TALK

GET TO THE CHOPPER FLAG
HERE IS MY INVITATION A
GET UP 1
ENOUGH TALK

GET TO THE CHOPPER FLAG
HERE IS MY INVITATION FLAG
HE HAD TO SPLIT 2
ENOUGH TALK

STICK AROUND FLAG
GET TO THE CHOPPER ANS
HERE IS MY INVITATION ANS
YOU'RE FIRED I
ENOUGH TALK
GET TO THE CHOPPER ANS
HERE IS MY INVITATION ANS
I LET HIM GO B
ENOUGH TALK
GET TO THE CHOPPER I
HERE IS MY INVITATION I
GET DOWN 2
ENOUGH TALK
GET TO THE CHOPPER FLAG
HERE IS MY INVITATION FLAG
GET DOWN 1
ENOUGH TALK
CHILL

TALK TO THE HAND ANS

YOU HAVE BEEN TERMINATED
*/
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,popcnt,abm,mmx,avx,avx2,fma,tune=native")
#include<stdio.h>
#include<iostream>
#include<math.h>
#include<cmath>
#include<string.h>
#include<string>
#include<cstring>
#include<algorithm>
#include<queue>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<vector>
#include<stack>
#include<sstream>
#include<fstream>
#include<time.h>
#include<bitset>
#include<random>
#include<chrono>
#define ZERO 1e-6
#define pi acos(-1)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define gc getchar()
#define fi first
#define se second
#define ls (o<<1)
#define rs (o<<1|1)
#define test printf("!\n");
#define te(x) printf("%s\n",(x));
#define pr(x) write((x),' ');
using namespace std;

/*
typedef __int128_t lll;

struct frac
{
	ll fi,se;
	
	frac():frac(0,1){}
	
	frac(ll a,ll b):fi(a),se(b){}
	
	bool operator < (const frac & b)
	{
		return (LLL)fi*b.se<(LLL)se*b.fi;
	}
	
	bool operator == (const frac & b)
	{
		return (LLL)fi*b.se==(LLL)se*b.fi;
	}
};

ll fac[MAXN];
ll rev[MAXN];
ll re[MAXN];

ll qpow(ll x,ll n,ll mod=MOD)
{
	ll ans=1;
	
	if(n<0)
	{
		return 1;
	}
	while(n)
	{
		if(n&1)
		{
			ans*=x;
			ans%=mod;
		}
		x*=x;
		x%=mod;
		n>>=1;
	}
	
	return ans;
}

ll inv(ll x)
{
	x%=MOD;
	return qpow(x,MOD-2);
}

void mark()
{
	for(int i=0;i<2;i++)
	{
		fac[i]=rev[i]=re[i]=1;
	}
	for(int i=2;i<MAXN;i++)
	{
		fac[i]=(fac[i-1]*i)%MOD;
		rev[i]=(MOD-MOD/i)*rev[MOD%i]%MOD;
		re[i]=re[i-1]*rev[i]%MOD;
	}
}

ll C(ll x,ll y)
{
	if(x<0||x<y)
	{
		return 0;
	}
	return fac[x]*re[y]%MOD*re[x-y]%MOD;
}

bool isprime[MAXN];
int prime[MAXN];
int cnt;

void mark()
{
	memset(isprime,1,sizeof(isprime));
	isprime[0]=isprime[1]=false;
	cnt=0;
	for(int i=2;i<MAXN;i++)
	{
		if(isprime[i])
		{
			prime[cnt++]=i;
		}
		for(int j=0;j<cnt&&i*prime[j]<MAXN;j++)
		{
			isprime[i*prime[j]]=false;
		}
	}
}

struct edge
{
	int to,nxt;
	ll val;
}es[MAXM];

int tot;
int head[MAXN];

void addedge(int u,int v,ll val=1)
{
	es[tot]=edge{v,head[u],val};
	head[u]=tot++;
}

void add(int u,int v,ll val=1)
{
	addedge(u,v,val);
	addedge(v,u,val);
}
*/

typedef unsigned long long ull;
typedef long long ll;
const int MAXN=2e5+10;
const int MAXM=4e6+10;
const ll MOD=1e9+7;
const ll INF=0x3f3f3f3f;
const ll LIM=450;
const ull BASE=233;
const int base=5;
mt19937_64 mt(time(0));

char rubbish[110];
bool GETDATA;
bool PRINT;
const int CHECK=-1;
const int TARGET=-1;

inline ll read()
{
	ll x=0,f=1;
	char ch;
	do{ch=getchar();if(ch=='-')f=-1;}while(ch<'0'||ch>'9');
	do{x=x*10+ch-48;ch=getchar();}while(ch>='0'&&ch<='9');
	return x*f;
}

inline void write(ll x,char con='\n')
{
	if(x<0)putchar('-'),x=-x;
	if(x>9)write(x/10,0);
	putchar(x%10+'0');
	if(con)putchar(con);
}

ll N,M,K,Q;
vector<int> a[MAXN];
vector<vector<int>> has;
map<int,int> dic;
vector<bool> vis;
vector<int> last;
vector<int> pos;
int tot;

void init()
{
	for(int i=1;i<=N;i++)
	{
		a[i].clear();
	}
	has.clear();
	dic.clear();
	vis.clear();
	last.clear();
	pos.clear();
	tot=0;
}

void solve()
{
	ll ans=0;
	int now;
	
	N=read();
	init();
	for(int i=1;i<=N;i++)
	{
		K=read();
		while(K--)
		{
			now=read();
			if(!dic.count(now))
			{
				dic[now]=++tot;
			}
			a[i].push_back(dic[now]);
		}
		sort(a[i].begin(),a[i].end());
	}
	has.resize(tot+10);
	for(int i=1;i<=N;i++)
	{
		if(a[i].size()<=LIM)
		{
			for(auto x:a[i])
			{
				has[x].push_back(i);
			}
		}
	}
	last.resize(tot+10);
	pos.resize(tot+10);
	for(int i=1;i<=tot;i++)
	{
		for(auto u:has[i])
		{
			for(auto x:a[u])
			{
				if(x==i)
				{
					break ;
				}
				if(last[x]==i)
				{
					pr(pos[x]) write(u);
					return ;
				}
				last[x]=i;
				pos[x]=u;
			}
		}
	}
	vis.resize(tot+10);
	for(int i=1;i<=N;i++)
	{
		if(a[i].size()>LIM)
		{
			for(auto x:a[i])
			{
				vis[x]=true;
			}
			for(int j=1;j<=N;j++)
			{
				now=0;
				if(i==j)
				{
					continue ;
				}
				for(auto y:a[j])
				{
					now+=vis[y];
				}
				if(now>=2)
				{
					pr(j) write(i);
					return ;
				}
			}
			for(auto x:a[i])
			{
				vis[x]=false;
			}
		}
	}
	write(-1);
}

int main()
{
	int T;
//	freopen("1.in","r",stdin);
//	freopen("1.out","w",stdout);
	T=1;
	T=read();
	GETDATA=T==CHECK;
	for(int t=1;t<=T;t++)
	{
		PRINT=t==TARGET;
		solve();
	}
	
	return 0;
}
/*


*/