The Olympic Games have just started and Federico is eager to watch the marathon race.

There will be n athletes, numbered from 1 to n, competing in the marathon, and all of them have taken part in 5 important marathons, numbered from 1 to 5, in the past. For each 1≤ i≤ n and 1≤ j≤ 5, Federico remembers that athlete i ranked r_{i,j}-th in marathon j (e.g., r_{2,4}=3 means that athlete 2 was third in marathon 4).

Federico considers athlete x superior to athlete y if athlete x ranked better than athlete y in at least 3 past marathons, i.e., r_{x,j}<r_{y,j} for at least 3 distinct values of j.

Federico believes that an athlete is likely to get the gold medal at the Olympics if he is superior to all other athletes.

Find any athlete who is likely to get the gold medal (that is, an athlete who is superior to all other athletes), or determine that there is no such athlete.

Input

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

The first line of each test case contains a single integer n (1≤ n≤ 50 000) — the number of athletes.

Then n lines follow, each describing the ranking positions of one athlete.

The i-th of these lines contains the 5 integers r_{i,1},\,r_{i,2},\,r_{i,3},\,r_{i,4},  r_{i,5} (1≤ r_{i,j}≤ 50 000) — the ranking positions of athlete i in the past 5 marathons. It is guaranteed that, in each of the 5 past marathons, the n athletes have distinct ranking positions, i.e., for each 1≤ j≤ 5, the n values r_{1,j},  r_{2, j},  ...,  r_{n, j} are distinct.

It is guaranteed that the sum of n over all test cases does not exceed 50 000.

Output

For each test case, print a single integer — the number of an athlete who is likely to get the gold medal (that is, an athlete who is superior to all other athletes). If there are no such athletes, print -1. If there is more than such one athlete, print any of them.

Example

Input


4
1
50000 1 50000 50000 50000
3
10 10 20 30 30
20 20 30 10 10
30 30 10 20 20
3
1 1 1 1 1
2 2 2 2 2
3 3 3 3 3
6
9 5 3 7 1
7 4 1 6 8
5 6 7 3 2
6 7 8 8 6
4 2 2 4 5
8 3 6 9 4


Output


1
-1
1
5

Note

Explanation of the first test case: There is only one athlete, therefore he is superior to everyone else (since there is no one else), and thus he is likely to get the gold medal.

Explanation of the second test case: There are n=3 athletes. 

  * Athlete 1 is superior to athlete 2. Indeed athlete 1 ranks better than athlete 2 in the marathons 1, 2 and 3. 
  * Athlete 2 is superior to athlete 3. Indeed athlete 2 ranks better than athlete 3 in the marathons 1, 2, 4 and 5. 
  * Athlete 3 is superior to athlete 1. Indeed athlete 3 ranks better than athlete 1 in the marathons 3, 4 and 5. 



Explanation of the third test case: There are n=3 athletes. 

  * Athlete 1 is superior to athletes 2 and 3. Since he is superior to all other athletes, he is likely to get the gold medal. 
  * Athlete 2 is superior to athlete 3. 
  * Athlete 3 is not superior to any other athlete. 



Explanation of the fourth test case: There are n=6 athletes. 

  * Athlete 1 is superior to athletes 3, 4, 6. 
  * Athlete 2 is superior to athletes 1, 4, 6. 
  * Athlete 3 is superior to athletes 2, 4, 6. 
  * Athlete 4 is not superior to any other athlete. 
  * Athlete 5 is superior to athletes 1, 2, 3, 4, 6. Since he is superior to all other athletes, he is likely to get the gold medal. 
  * Athlete 6 is only superior to athlete 4. 
											import java.math.BigInteger;
											import java.sql.Array;
										    import java.util.ArrayList;
											import java.util.Arrays;
											import java.util.Collection;
											import java.util.Collections;
											import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
		import java.util.HashSet;
		import java.util.InputMismatchException;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;
													import java.util.Set;
													import java.util.Stack;
											import java.io.BufferedReader;
											import java.io.IOException;
											import java.io.InputStream;
											import java.io.InputStreamReader;
											import java.util.Scanner;
											import java.util.StringTokenizer;
											import java.util.TreeMap;
											import java.util.TreeSet;
										
											
											
											
											
											
											public class Main {
							
												
												static HashMap<Integer,Boolean>map;
												
											static long dp[][];
											static 	boolean flag;
										static	HashSet<Long>hs;
											static long mod=(long)(1e9+7);
												public static void main(String[] args) {
												StringBuilder ans=new StringBuilder();
												FastReader sc=new FastReader();
											
												int t=sc.nextInt();
											outer:	while(t-->0) {
												int n=sc.nextInt();
													
													
												ArrayList<PriorityQueue<colors>>A=new ArrayList<>();
												
												
													for(int i=0;i<5;i++)
														A.add(new PriorityQueue<Main.colors>(new Comparator<colors>() {
															@Override
															public int compare(colors o1, colors o2) {
																// TODO Auto-generated method stub
																return o1.n-o2.n;
															}
															})
															);
													ArrayList<PriorityQueue<colors>>B=new ArrayList<>();
														
													for(int i=0;i<n;i++) {
															
														
														for(int j=0;j<5;j++)
														A.get(j).add(new colors(i+1,sc.nextInt()));
														
										
													
													}
													
													if(n==1) {
														ans.append("1"+"\n");
														continue;
													}
													for(int i=0;i<5;i++)
														B.add(new PriorityQueue<Main.colors>(A.get(i)));
													int c[]=new int [n+1];
													int ranks[][]=new int [n+1][5];
													int over[]=new int [n+1];
													
													Arrays.fill(over, Integer.MAX_VALUE);
													for(int i=0;i<5;i++) {
														int j=0;
														while(!A.get(i).isEmpty())
 
											
														{
															j++;
															colors temp=A.get(i).poll();
															c[temp.c]+=j;
															if(j<5)
															++ranks[temp.c][j-1];
															over[temp.c]=Math.max(over[temp.c], j);
														
														}
														
													}
													
													
													
													
													
													//System.out.println(B.get(0).size());
													int w=-1;
													int curr=Integer.MAX_VALUE;
													int cand=1;
													 
												l:	for(int i=1;i<n+1;i++) {
														
														for(int m=0;m<5;m++) {
														if(ranks[i][m]>m||(m>0&&ranks[i][m]>=m)) {
															cand=i;
															ArrayList<PriorityQueue<colors>>C=new ArrayList<>();
															for(int j=0;j<5;j++)
																C.add(new PriorityQueue<Main.colors>(B.get(j)));
														
															boolean flag=false;
															int l[]=new int [n+1];
															
															for(int j=0;j<5;j++)
															{		
															//	System.out.println(B.get(i).peek().c);
																//System.out.println(B.get(j).size()+" "+i);
																while(B.get(j).peek().c!=cand)B.get(j).poll();
																
																B.get(j).poll();
																while(!B.get(j).isEmpty()) {
																	++l[B.get(j).poll().c];
																}
																
																
																
																
															
															}
															//System.out.println(cand);
															for(int k=1;k<n+1;k++)
															{if(k==cand)continue;
																//System.out.print(l[i]+" "+i);
																if(l[k]<3) {flag=true;
																break;}
															}
															B=new ArrayList<>();
															
															for(int j=0;j<5;j++)
																B.add(new PriorityQueue<Main.colors>(C.get(j)));
													
															
															if(!flag)
																{
																ans.append(String.valueOf(cand)+'\n');
																continue outer;
																}	
															else continue l;
														}
													
														
														
														
													}
													
													}
															
													ans.append(String.valueOf(-1)+'\n');		
												
												}
												ans.delete(ans.length()-1,ans.length());
												System.out.println(ans);
												}
												
											
												
										static class colors{
											
											int c;int n;
											public colors(int c,int n) {
												// TODO Auto-generated constructor stub
												this.c=c;
												this.n=n;
											}
											
										}
												
												
												
												
												static int CeilIndex(long A[], int l, int r, long key)
											    {
											        while (r - l > 1) {
											            int m = l + (r - l) / 2;
											            if (A[m] >= key)
											                r = m;
											            else
											                l = m;
											        }
											 
											        return r;
											    }
											 
												static int CeilIndexd(long A[], int l, int r, long key)
											    {
											        while (r - l > 1) {
											            int m = l + (r - l) / 2;
											            if (-1*A[m] >= key)
											                r = m;
											            else
											                l = m;
											        }
											 
											        return r;
											    }
											 
												
												
												
												static class Pair{
													long a;long b;
													public Pair(long a,long b) {
														// TODO Auto-generated constructor stub
														this.a=a;
														this.b=b;
													}
													
													
												}
												
												
											static void solve(ArrayList<Long>A,long bd) {
											
												if(bd>(long)1e9)return;
											//	if(hs.contains(bd))return;
												//A.add(bd);
												hs.add(bd);
												A.add(bd*10);
												A.add(bd*10+1);
											//	hs.add(bd*10);
												//hs.add(bd*10+1);
											
												solve(A,bd*10);
												solve(A,bd*10+1);
												
												
											}
												
												
												
												
												
												 static boolean isPrime(int n)
												    {
												        // Corner cases
												        if (n <= 1)
												            return false;
												        if (n <= 3)
												            return true;
												  
												        // This is checked so that we can skip
												        // middle five numbers in below loop
												        if (n % 2 == 0 || n % 3 == 0)
												            return false;
												  
												        for (int i = 5; i * i <= n; i = i + 6)
												            if (n % i == 0 || n % (i + 2) == 0)
												                return false;
												  
												        return true;
												    }
												  
												static long lcm(long a, long b)
											    {
											        return ((a / gcd(a, b))%mod * b%mod)%mod;
											    }
												   static long gcd(long a,long b)
												    {
												        if (a == 0)
												            return b%mod; 
												        return (gcd(b % a, a))%mod; 
												    }
												
									
												//System.out.println(count);
												
											
												
												
												static void dfs(int v,boolean visited[],ArrayList<ArrayList<Integer>>adj,int div[],int t)
												{
													visited[v]=true;
													
													div[v]=t+1;
													for(int u:adj.get(v)) {
														
														
														
														if(!visited[u]) {
															dfs(u,visited,adj,div,(t+1)%2);
														}
														
													}
													
													
												}
												
												
												static class Helper{
													
													int a;int b;int t;
													public Helper(int a,int b) {
														// TODO Auto-generated constructor stub
														
														this.a=a;
														this.b=b;
											
														
													
													}
													
													
												}
										
										
												
										
												
												
												
												
												//	System.out.println(max);
										
												
											
												
											
									
				//System.out.println(ans.toString());
				//main(						
											
							
					
				static void solvedfs(ArrayList<ArrayList<Integer>>adj,int n,int v,int subt[],int subtAns[],boolean []visited) {
							
							
							int count=1;
							int ans=0;
							visited[v]=true;
							for(int u:adj.get(v)) {
								
								
								if(!visited[u])
								{
									//System.out.println(v+" "+subt[v]+" "+n);
									subtAns[u]=Math.max(subtAns[u], subt[v]-subtAns[u]);
									
								solvedfs(adj, n, u, subt, subtAns, visited);			
								
								}
							}
							
						
							
							
							
							
							
						}
						
												
												
												
								static int dfs(ArrayList<ArrayList<Integer>>adj,int v,int subt[],int subtAns[],boolean []visited) {
								
									
									int count=0;
									int ans=0;
									visited[v]=true;
									for(int u:adj.get(v)) {
										
										
										if(!visited[u])
										{
											count+=ans;
											ans=Math.max(dfs(adj,u,subt,subtAns,visited),ans);
										}
									}
										subt[v]=count;
										subtAns[v]=ans;
										return ans+1;
										
									
									
									
									
									
								}
												
								
												
												
								static	int solve(ArrayList<ArrayList<Integer>>adj,int node,ArrayList<Integer>A)			
									{
										if(adj.get(node).size()==0)return 1;
										
										int count=0;
										for(int v:adj.get(node)) {
											
											count+=solve(adj,v,A);
											
										}
										
										A.set(node,count);
										return count+1;
										
										
										
									}
												
												
												
												
												
												
												
									static void dfs(String[]building,int i,int j,int n,int m, boolean visited[][]) {
										
										
										visited[i][j]=true;
										
										if(isValid(building,i+1,j,n,m,visited))
										{	visited[i+1][j]=true;
											dfs(building,i+1,j,n,m,visited);
										
										}
											if(isValid(building,i-1,j,n,m,visited))
										{
											visited[i-1][j]=true;
											dfs(building,i-1,j,n,m,visited);
										}
										 if(isValid(building,i,j+1,n,m,visited))
										{visited[i][j+1]=true;
											dfs(building,i,j+1,n,m,visited);
										}
												if(isValid(building,i,j-1,n,m,visited))
										{visited[i][j-1]=true;
											dfs(building,i,j-1,n,m,visited);
										}
										
										
										
										
									}
									static boolean isValid(String[]building,int i,int j,int n,int m, boolean visited[][])		
									{
										if(i==-1||j==-1||i==n||j==m||visited[i][j]||building[i].charAt(j)=='#')
											return false;
									return true;
									}
												
												
												
												
								static	void compute(boolean sieve[],int n) {
										
										for(int i=2;i<=n;i++) {
											if(sieve[i])continue;
											
											for(int j=2*i;j<n;j+=i)
											{
												sieve[j]=true;
											}
											
										}
											
										
										
									}
								
								static	void computeHs(boolean sieve[]) {
									int n=(int)(1e9-1e7+1);
									for(int i=1;i<n;i++) {
										if(sieve[i])continue;
										
										for(int j=2*i;j<n;j+=i)
										{
											sieve[j]=true;
										}
										
									}
									
								}
							
								
									
												
												
												static boolean isValid(StringBuilder s,int w) {
													if(w>s.length())return false;
													HashSet<Character>hs=new HashSet<Character>();
													int a[]=new int[3];
													
													for(int i=0;i<w;i++) {
													
														++a[s.charAt(i)-49];
														
													}
													
													if(a[0]>0&&a[1]>0&&a[2]>0)return true;
												
													int start=0;
													int end=w;
													
													while(end!=s.length()) {
														--a[s.charAt(start)-49];
														
															++a[s.charAt(end)-49];
														
																	start++;
																		end++;
																		if(a[0]>0&&a[1]>0&&a[2]>0)return true;
																				
													}
													return false;
													
													
													
												}
								
												
												
												
									
							
												
									static int find(int parent[],int i) {
										
										if(parent[i]==-1)return i;
										
										return parent[i]=find(parent,parent[i]);
										
									}
									static void union(int parent[],int rank[],int s1,int s2) {
										
										if(rank[s1]>=rank[s2]) {
											
											parent[s2]=s1;
											rank[s1]+=rank[s2];
										}
										
										else {
											
											parent[s1]=s2;
											rank[s2]+=rank[s1];
										}
										
										
									}
												
												
												
												
												
												
												
												
												
												
												
									static	int solve(String S,int K) {
											
											if(K<=0)return 0;
											if(S.charAt(K-1)!=S.charAt(K))
											return 1+solve(S,K-1);
											else return solve(S,K-1);
										}
										
										
										
										
				
				
					
				static	boolean isValid(int g[][],int r,int c,int n,int m,boolean visited[][],int s) {
						if(r==-1||r==n||c==-1||c==m||visited[r][c]||g[r][c]!=s)return false;
						return true;
					}
				
										
											
																					
											
									    static class FastReader {
									        BufferedReader br;
									        StringTokenizer st;
									 
									        public FastReader()
									        {
									            br = new BufferedReader(
									                new InputStreamReader(System.in));
									        }
									 
									        String next()
									        {
									            while (st == null || !st.hasMoreElements()) {
									                try {
									                    st = new StringTokenizer(br.readLine());
									                }
									                catch (IOException e) {
									                    e.printStackTrace();
									                }
									            }
									            return st.nextToken();
									        }
									 
									        int nextInt() { return Integer.parseInt(next()); }
									 
									        long nextLong() { return Long.parseLong(next()); }
									 
									        double nextDouble()
									        {
									            return Double.parseDouble(next());
									        }
									 
									        String nextLine()
									        {
									            String str = "";
									            try {
									                str = br.readLine();
									            }
									            catch (IOException e) {
									                e.printStackTrace();
									            }
									            return str;
									        }
									    }
									 
										
											}
											
											
											
											
											    