#include<stdio.h>

int main()

{

int r=0, p1=0,i,j,p2=0;

int temp=0,lead=0;

```
scanf("%d",&r);
for(i=0; i<r; i++){
scanf("%d %d",&p1,&p2);
//if((p1<0 || p1>1000)||(p2<0 || p2> 1000)){break;}
if(p1>p2){
if(temp<(p1-p2)){ temp = p1-p2;lead=1;}
}
else if(p2>p1){
if(temp<(p2-p1)){ temp = p2-p1;lead=2;}
}else{}
}
printf("%d %d\n",lead,temp);
return 0;
```

}