import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner s = new Scanner(System.in);
int num = s.nextInt();
int[][] arr = new int[num][5];
int num2;
int numStudent;
int result = -1;
int resultNumber = 0;
for (int i=0;i<num;i++){
for (int j=0;j<5;j++){
num2 = s.nextInt();
arr[i][j] = num2;
}
}
for (int i=0;i<num;i++){
numStudent = 0;
for (int j=0;j<num;j++){
if (i == j) continue;
if (arr[i][0] == arr[j][0] ||
arr[i][1] == arr[j][1] ||
arr[i][2] == arr[j][2] ||
arr[i][3] == arr[j][3] ||
arr[i][4] == arr[j][4]) numStudent++;
}
if (result < numStudent){
result = numStudent;
resultNumber = i + 1;
}
}
System.out.print(resultNumber);
}
}