#include<iostream>
#include<algorithm>
using namespace std;
const int N=1000;
int x,y;
int k=0;
struct position
{
int i,j;
bool operator<(const position& t)const
{
if(i!=t.i) return i<t.i;
else return j<t.j;
}
}p[N];
int main()
{
while(true)
{
cin>>x>>y;
if(x==0&&y==0) break;
else
{
p[k].i=x;
p[k].j=y;
k++;
}
}
sort(p,p+k);
cout<<p[0].i<<" "<<p[0].j<<endl;
cout<<p[k-1].i<<" "<<p[k-1].j<<endl;
return 0;
}