import java.util.Scanner;
public class TheLeadGame {
public static void main(String[] args)
{
Scanner one = new Scanner(System.in);
int N = one.nextInt();
int leader = 0, total=-1,num = 0, player = 0;
int[] array = new int[N];
int[] array2 = new int[N];
for(int i=0;i<N;i++)
{
int W =one.nextInt();
int L = one.nextInt();
int lead = Math.abs(W-L);
array[i]=lead;
if(W>L)
{
leader = 1;
}
else
{
leader = 2;
}
array2[i] = leader;
}
for(int j=0;j<N;j++)
{
num=array[j];
if(num>total)
{
total=num;
player = array2[j];
}
}
System.out.println(player+" "+total);
one.close();
}
}