import java.util.Scanner;

class the_lead_game {

```
static Scanner scan = new Scanner(System.in);
public static void main(String[] args) {
int n,a[],b[],i,diff[][],max,lead = 0;
//Enter n ::
n = scan.nextInt();
a = new int[n];
b = new int[n];
diff = new int[n][2];
for(i=0;i<n;i++)
{
//Enter a and b ::
a[i] = scan.nextInt();
b[i] = scan.nextInt();
}
for(i=0;i<n;i++)
{
if(a[i] > b[i])
{
diff[i][0] = a[i] - b[i];
diff[i][1] = 1;
}
if(b[i] > a[i])
{
diff[i][0] = b[i] - a[i];
diff[i][1] = 2;
}
}
max = diff[0][0];
lead = diff[0][1];
for(i=0;i<n;i++)
{
if(diff[i][0] > max)
{
max = diff[i][0];
lead = diff[i][1];
}
}
System.out.println(lead+" "+max);
}
```

}