//package dsa;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
class Codechef
{
public static void main(String [] args)
{
try {
Scanner sc=new Scanner(System.in);
int n =sc.nextInt();
List<Integer>l1=new ArrayList<>();
List<Integer>l2=new ArrayList<>();
int s1[] = new int[n];
int s2[] = new int[n];
s1[0]=sc.nextInt();
s2[0]=sc.nextInt();
if(s1[0]-s2[0]>0)
l1.add(s1[0]-s2[0]);
else
l2.add(s2[0]-s1[0]);
for(int i=1;i<n;i++)
{
s1[i]=s1[i-1]+sc.nextInt();
s2[i]=s2[i-1]+sc.nextInt();
if(s1[i]-s2[i]>0)
l1.add(s1[i]-s2[i]);
else
l2.add(s2[i]-s1[i]);
}
Collections.sort(l1,Collections.reverseOrder());
Collections.sort(l2,Collections.reverseOrder());
// System.out.print(l1+" "+l2);
if(l1.get(0)>l2.get(0))
System.out.println("1 "+l1.get(0));
else
System.out.println("2 "+l2.get(0));
}
catch(Exception e)
{//System.out.print("404");
return;
}
}
}