import java.util.*;
public class Main {
public static void main(String[] args) {
ArrayList<Point> arr = new ArrayList<Point>();
arr.add(new Point(1,2));
arr.add(new Point(5,3));
arr.add(new Point(4,6));
arr.add(new Point(7,5));
arr.add(new Point(9,0));
Collections.sort(arr, new Com1());
ArrayList<Point> result = new ArrayList<Point>();
Point target, temp;
for(int i=0; i<arr.size(); i++){
target = arr.get(i);
boolean flag = true;
for(int j=i+1; j<arr.size(); j++){
temp = arr.get(j);
if(temp.x>target.x && temp.y>target.y){
flag = false;
break;
}
}
if(flag==true)
result.add(target);
}
for(int i=0; i<result.size(); i++){
target = result.get(i);
System.out.println(target.x+" "+target.y);
}
}
}
class Point{
int x,y;
public Point(int x, int y){
this.x = x;
this.y = y;
}
}
class Com1 implements Comparator<Point>{
public int compare(Point a, Point b){
return a.x - b.x;
}
}