#include
using namespace std;
#include
int main(){
long int no,a;
cin>>no;
long int roundp1[no];
long int roundp2[no];
long int lead[no];
long int maxi1=0;
long int maxi2=0;
for (a=0;a<no;++a){
cin>>(roundp1[a])>>(roundp2[a]);
lead[a]=roundp1[a] - roundp2[a];
if (lead[a]>0){
if (lead[a]>maxi1){
maxi1=lead[a];
}
}
if ( lead[a]<0){
if ( (abs(lead[a])>maxi2) ){
maxi2=abs(lead[a]);
}
}
if (lead[a]==0){
lead[a]=0;
}
}
if (maxi1>maxi2){
int winp=1;
cout<<winp<<maxi1;
}
if (maxi1<maxi2){
int winp=2;
cout<<winp<<maxi2;
}
return 0;
}