/*有没有小伙伴帮忙分析一下,提交完0%……*/
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while(sc.hasNextLine()){
            int n = sc.nextInt();
            int[][] arr = new int[n][2];
            for(int i = 0;i<n;i++){
                arr[i][0]=sc.nextInt();
                arr[i][1]=sc.nextInt();
            }
            Map map = new HashMap() ;
            for(int i = 0;i<n;i++){
                int j;
                for( j=i+1 ; j<n; j++){
                    if(arr[j][0]>arr[i][0]&&arr[j][1]>arr[i][1])
                        break;
                }
                if(j == n)
                    map.put(arr[i][0],arr[i][1]);
            }
            for(Object key : map.keySet()){
                System.out.println(key+" "+map.get(key));
            }
        }
        sc.close();
    }
}