import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String[] s = new String[n]; String[] x = new String[n]; for(int i = 0 ; i < n ; i++) { s[i] = sc.next(); x[i] = sc.next(); if(s[i].equals(x[i])) { System.out.println(s[i]); System.out.println(x[i]); return; } } } }