/*
* 我的想法:先找到P中横坐标最大的点A(Xmax,Ya),以及纵坐标最大点B(Xb,Ymax),可知满足x定义的点必定在以AB为对角线的矩形范围内。
* 由于笔试OJ实在太卡,最后提交时都不知道通过率是多少,也不知道这种接法对不对?
*/
#include <cstdio>
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;
struct Point
{
unsigned int x;
unsigned int y;
};
bool compare(Point A, Point B)
{
return A.x < B.x ? true : false;
}
int main()
{
int N;
vector<Point> pset;
vector<Point> ans;
while (cin >> N)
{
pset.clear();
ans.clear();
for (int i = 0; i < N; ++i)
{
Point pt;
cin >> pt.x;
cin >> pt.y;
pset.push_back(pt);
}
//寻找x最大点,y最大点
Point xmax = { 0,0 }, ymax = {0,0};
for (int i = 0; i < N; i++)
{
if (xmax.x < pset[i].x)
xmax = pset[i];
if (ymax.y < pset[i].y)
ymax = pset[i];
}
for (int i = 0; i < N; i++)
{
if ((pset[i].x >= ymax.x) && (pset[i].y >= xmax.y))
ans.push_back(pset[i]);
}
sort(ans.begin(), ans.end(), compare);
for (int i = 0; i < ans.size(); i++)
{
cout << ans[i].x << " " << ans[i].y << endl;
}
}
}