#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
class point
{
long long x;
long long y;
public:
long long getx(){return x;}
long long gety(){return y;}
point(long long xsize,long long ysize):x(xsize),y(ysize){}
~point(){}
};
bool comp(point* p1,point*p2)
{
return p1->getx()<p2->getx();
}
vector<point> Maxpointset(long long N,vector<point*> &vin)
{
//deque<long long> d;
vector<point> v;
long long j;
if(N<1||vin.size()==0)
return v;
sort(vin.begin(),vin.end(),comp);
for(long long i=0;i<N/2;i++)
{
for(j=i+1;j<N/2;j++)
{
if(vin[j]->gety()>vin[i]->gety())
break;
}
if(j==N/2)
v.push_back(*vin[i]);
}
return v;
}
int main()
{
long long N;
cin>>N;
vector<long long> v(2*N);
vector<point*> vi(N);
//cout<<v.capacity();
for(int i=0;i<2*N;i++)
{
cin>>v[i];
if(i%2==1)
vi[(i-1)/2] = new point(v[i-1],v[i]);
}
vector<point> v2= Maxpointset(2*N,vi);
for(long long i=0;i<N/2;i++)
{
delete vi[i];
}
for(long long i=0;i<v2.size();i++)
{
cout<<v2[i].getx()<<" "<<v2[i].gety()<<endl;
}
return 0;
}
#C++工程师#