import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scn = new Scanner(System.in);
int n=scn.nextInt(),arr[][]=new int [n][3],i;
ArrayList <Integer>list =new ArrayList<Integer>();
for(i=0;i<n;i++){
arr[i][0]=scn.nextInt();
arr[i][1]=scn.nextInt();
arr[i][2]=scn.nextInt();
}
for(i=0;i<3;i++){
if(n==1){
System.out.println("1");
break;
}
int ary[]=new int [n];
for(int j=0;j<n;j++){
if(!list.contains(j))
ary[j]=arr[j][i];
}
Arrays.sort(ary);
if(ary[n-1]==ary[n-2]){
for(int j=0;j<n;j++){
if(arr[j][i]!=ary[n-1])
list.add(j);
}
}
else{
for(int k=0;k<n;k++){
if(arr[k][i]==ary[n-1]){
System.out.println(arr[k][3]);
}
}
break;
}
}
if(i==3)
System.out.println("Fail");
}
}