#include

using namespace std;

int main(){

long long int n;

int i,j;

cin>>n;

if(n<0 || n>10000)

return 0;

int s[n];

int t[n];

int lead[n];

for(i=0;i<n;i++){

cin>>s[i];

if(s[i]<=0 || s[i]>1000)

return 0;

cin>>t[i];

if(t[i]<=0 || t[i]>1000)

return 0;

if(s[i]>t[i])

lead[i]=s[i]-t[i];

else

lead[i]=t[i]-s[i];

}

int temp=0;

int lead1[n];

for(i=0;i<n;i++)

lead1[i]=lead[i];

for(i=0;i<n;i++){

for(j=0;j<n;j++){

if(lead[i]>lead[j]){

temp=lead[i];

lead[i]=lead[j];

lead[j]=temp;

}

}

}

for(i=0;i<n;i++){

if(lead1[i]==lead[0]){

if(s[i]>t[i])

cout<<"1 "<<lead[0];

else

cout<<"2 "<<lead[0];

break;

}

}

}