import java.util.*;
public class Main{
public static void main(String[] args){
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int[] arr = new int[n*2];
int count = 0;
for(int i=0;i<n*2;i++){
arr[i] = scanner.nextInt();
}
for (int i = 0; i < n * 2; i = i + 2) {
for (int j = i + 2; j < n * 2; j = j + 2) {
if (arr[i] < arr[j]) {
if (arr[i + 1] > arr[j + 1]) {
count++;
if (count == ((n * 2 - i) / 2)) {
System.out.println(arr[i] + " " + arr[i + 1]);
count = 0;
}
}
}
}
}
System.out.println(arr[n*2-2]+" "+arr[n*2-1]);
}
}
//这样写如何