#include <iostream>
#include <algorithm>
using namespace std;
struct player
{
int atk=0;
int def=0;
long long add=0;
};
int main() {
player a[150];
long long s[150];
int n;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>a[i].atk>>a[i].def;
a[i].add=a[i].atk*a[i].atk+a[i].def*a[i].def;
s[i]=a[i].add;
}
sort(s+0,s+n);
for(int i=0;i<n;i++)
{
if(a[i].add==s[n-2])
{
cout<<a[i].atk<<" "<<a[i].def;
break;
}
}
return 0;
}