#include<bits/stdc++.h>
 
using namespace std;
 
typedef long long int ll;
typedef long double ld;
#define f first
#define s second
 
const int N = 2e5 + 100;
const int sq = 90;
const ll mod = 1e9 + 7;
const ll inf = 1e17;


map<int, int> ind[N];
bool mark[N];
vector<int> v[N];
int c[N], h[N], l[N];
int sc, sl, sh;

inline void solve()
{
	sc = sl = sh = 0;
	int n;
	scanf("%d", &n);
	for(int i = 0; i < n; i++)
	{	
		v[i].clear();
		int k;
		scanf("%d", &k);
		for(int j = 0; j < k; j++)
		{
			int x;
			scanf("%d", &x);
			v[i].push_back(x);
			c[sc++] = x;
		}
		if(v[i].size() > sq)
			h[sh++] = i;
		else
			l[sl++] = i;
	}
	
	sort(c, c+sc);
	
	for(int i = 0; i < sc; i++)
	{
		ind[i].clear();
		mark[i] = false;
	}
	
	for(int i = 0; i < n; i++)
	{
		for(int j = 0; j < v[i].size(); j++)
		{
			v[i][j] = lower_bound(c, c + sc, v[i][j]) - c;
		}
	}
	
	
	
	for(int j = 0; j < sh; j++)			///heavy-heavy and heavy-light
	{
		int x = h[j];
		for(auto y : v[x])
			mark[y] = true;
		for(int i = 0; i < n; i++)
		{
			if(i == x)
				continue;
			int cnt = 0;
			for(auto y : v[i])
				cnt += mark[y];
			if(cnt > 1)
			{
				//cout << x+1 << ' ' << i+1 << '\n';
				printf("%d %d \n", x+1, i+1);
				return;
			}
			
		}
		for(auto y : v[x])
			mark[y] = false;
	}

	
	for(int j = 0; j < sl; j++)		// light-light
	{
		int x = l[j];
		//cout << x << "///" << v[x].size() << endl;
		for(auto a : v[x])
		{
			for(auto b : v[x])
			{
				if(a < b)
				{
					//cout << c[a] << ' ' << c[b] << endl;
					if(ind[a][b] != 0)
					{
						//cout << x + 1 << ' ' << ind[a][b] << '\n';
						printf("%d %d \n", x+1, ind[a][b]);
						return;
					}
					ind[a][b] = x+1;
				}
			}
		} 
	}
		
	printf("%d \n", -1);
	//cout << -1 << endl;
	return;

		
}




int main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	
	int q;
	scanf("%d", &q);
	while(q--)
	{
		solve();
	}	
	
	
	

	
    return 0;
}
 
