import java.util.*; public class Main { public static void main(String[] args) { Scanner shuru=new Scanner(System.in); int n,x,y=0; int [][] a; n=shuru.nextInt(); a = new int [n][2]; for(int i=0;i<n;i++) { for(int j=0;j<2;j++) { a[i][j]=shuru.nextInt(); } } x = shuru.nextInt(); for(int i=0;i<a.length;i++) { if(a[i][0]==x) { System.out.println(a[i][0]+" "+a[i][1]); y=1; } else { ; } } if(y==0) { System.out.println("wrong"); } else { ; } } }