description: 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. 
solution: import java.awt.List;
  import java.io.BufferedReader;
  import java.io.IOException;
  import java.io.InputStreamReader;
  import java.util.ArrayList;
  import java.util.Arrays;
  import java.util.Collections;
  import java.util.Random;
  import java.util.StringTokenizer;
  public class B{
  // author: Tarun Verma
  static FastScanner sc = new FastScanner();
  static int inf = Integer.MAX_VALUE;
  static long mod = 1000000007;
  
  static boolean isPalindrom(char[] arr, int i, int j) {
  	boolean ok = true;
  	while (i <= j) {
  		if (arr[i] != arr[j]) {
  			ok = false;
  			break;
  		}
  		i++;
  		j--;
  	}
  	return ok;
  }
  
  static int max(int a, int b) {
  	return Math.max(a, b);
  }
  
  static int min(int a, int b) {
  	return Math.min(a, b);
  }
  
  static long max(long a, long b) {
  	return Math.max(a, b);
  }
  
  static long min(long a, long b) {
  	return Math.min(a, b);
  }
  
  static int abs(int a) {
  	return Math.abs(a);
  }
  
  static long abs(long a) {
  	return Math.abs(a);
  }
  
  static void swap(long arr[], int i, int j) {
  	long temp = arr[i];
  	arr[i] = arr[j];
  	arr[j] = temp;
  }
  
  static void swap(int arr[], int i, int j) {
  	int temp = arr[i];
  	arr[i] = arr[j];
  	arr[j] = temp;
  }
  
  static int maxArr(int arr[]) {
  	int maxi = Integer.MIN_VALUE;
  	for (int x : arr)
  		maxi = max(maxi, x);
  	return maxi;
  }
  
  static int minArr(int arr[]) {
  	int mini = Integer.MAX_VALUE;
  	for (int x : arr)
  		mini = min(mini, x);
  	return mini;
  }
  
  static long maxArr(long arr[]) {
  	long maxi = Long.MIN_VALUE;
  	for (long x : arr)
  		maxi = max(maxi, x);
  	return maxi;
  }
  
  static long minArr(long arr[]) {
  	long mini = Long.MAX_VALUE;
  	for (long x : arr)
  		mini = min(mini, x);
  	return mini;
  }
  
  static int gcd(int a, int b) {
  	if (b == 0)
  		return a;
  	return gcd(b, a % b);
  }
  
  static long gcd(long a, long b) {
  	if (b == 0)
  		return a;
  	return gcd(b, a % b);
  }
  
  static void ruffleSort(int[] a) {
  	int n = a.length;
  	Random r = new Random();
  	for (int i = 0; i < a.length; i++) {
  		int oi = r.nextInt(n);
  		int temp = a[i];
  		a[i] = a[oi];
  		a[oi] = temp;
  	}
  	Arrays.sort(a);
  }
  
  public static int binarySearch(int a[], int target) {
  	int left = 0;
  	int right = a.length - 1;
  	int mid = (left + right) / 2;
  	int i = 0;
  	while (left <= right) {
  		if (a[mid] <= target) {
  			i = mid + 1;
  			left = mid + 1;
  		} else {
  			right = mid - 1;
  		}
  		mid = (left + right) / 2;
  	}
  	return i;
  }
  
  static class FastScanner {
  	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
  	StringTokenizer st = new StringTokenizer("");
  
  	String next() {
  		while (!st.hasMoreTokens())
  			try {
  				st = new StringTokenizer(br.readLine());
  			} catch (IOException e) {
  				e.printStackTrace();
  			}
  		return st.nextToken();
  	}
  
  	int nextInt() {
  		return Integer.parseInt(next());
  	}
  
  	int[] readArray(int n) {
  		int[] a = new int[n];
  		for (int i = 0; i < n; i++)
  			a[i] = nextInt();
  		return a;
  	}
  
  	int[][] read2dArray(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] = nextInt();
  			}
  		}
  		return arr;
  	}
  
  	ArrayList<Integer> readArrayList(int n) {
  		ArrayList<Integer> arr = new ArrayList<Integer>();
  		for (int i = 0; i < n; i++) {
  			int a = nextInt();
  			arr.add(a);
  		}
  		return arr;
  	}
  
  	long nextLong() {
  		return Long.parseLong(next());
  	}
  }
  
  static class pair {
  	int fr, sc;
  
  	pair(int fr, int sc) {
  		this.fr = fr;
  		this.sc = sc;
  	}
  }
  
  ////////////////////////////////////////////////////////////////////////////////////
  ////////////////////DO NOT TOUCH BEFORE THIS LINE //////////////////////////////////
  ////////////////////////////////////////////////////////////////////////////////////
  public static void solve() {
  	int n = sc.nextInt();
  	int arr[][] = sc.read2dArray(n, 5);
  	int max = 0;
  	for(int i =1;i<n;i++) {
  		int cnt = 0;
  		for(int j =0;j<5;j++) {
  			if(arr[max][j] < arr[i][j]) {
  				cnt++;
  			}
  		}
  		if(cnt < 3) {
  			max = i;
  		}
  	}
  	for(int i =0;i<n;i++) {
  		if(i == max) continue;
  		int cnt = 0;
  		for(int j =0;j<5;j++) {
  			if(arr[max][j] < arr[i][j]) {
  				cnt++;
  			}
  		}
  		if(cnt < 3) {
  			System.out.println(-1);
  			return;
  		}
  	}
  	System.out.println(max+1);
  }
  
  public static void main(String[] args) {
  	int t = 1;
  	t = sc.nextInt();
  	outer: for (int tt = 0; tt < t; tt++) {
  		solve();
  	}
  }
  /* Common Mistakes By Me
   * make sure to read the bottom part of question
   * special cases (n=1?)
   * In Game Theory Check your solution and consider all the solutions
   * Always initialise value to the declare array in local scope
   * don't use debugs in interactive problems
   * Always Reset vis,adj array upto n+1 otherwise can cause TLE
  */
  ////////////////////////////////////////////////////////////////////////////////////	
  
  }