import java.io.*;
import java.lang.Math;
class Lead_Game
{
public static void main (String[] args) throws IOException
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int t = Integer.parseInt(br.readLine());
int max = 0;
String[] ar = {};
int p1 = 0;
int p2 = 0;
int x = 0,y = 0;
for(int i = 0;i < t; i++){
ar = (br.readLine()).split(" ");
p1 = Integer.parseInt(ar[0]);
p2 = Integer.parseInt(ar[1]);
if(Math.abs(p1-p2) > max){
max = Math.abs(p1-p2);
x = p1;
y = p2;
}
else{
continue;
}
}
if(x > y){
System.out.println("1 "+max);
}
else{
System.out.println("2 "+max);
}
}
}