#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<iomanip>
#include<string>
#include<bitset>
#include<algorithm>
#include<queue>
#include<deque>
#include<list>
#include<map>
#include<set>
#include<stack>
#include<vector>
#include<array>
#include <numeric>
#include <limits>
#define ll long long;
using namespace std;
struct point
{
int x,y;
};
bool operator<(const point&p1,const point&p2)
{
if(p1.x<p2.x)return 1;
if(p1.x==p2.x&&p1.y<p2.y)return 1;
return 0;
}
int main(){
int n,i;
cin>>n;
vector<point>points(n);
vector<bool>isMax(n,0);
i=n;
while(i--)
{
scanf("%d%d",&points[i].x,&points[i].y);
}
sort(points.begin(),points.end());
int f=n-1;
for(i=n-2;i>=0;--i)
{
if(points[i].y>points[f].y){f=i;continue;}
isMax[i]=1;
}
for(int i=0;i<n;++i)
{
if(!isMax[i])
printf("%d %d\n",points[i].x,points[i].y);
}
}
用的c++,主要是输入输出,java的输入输出效率实在是难受