while True:
    try:
        n = int(input())
        arr = []
        brr = []
        for i in range(n):
            a, b = map(int, input().split())
            arr.append(a)
            brr.append(b)
        t = 999999999
        c = -1
        for i in arr:
            
            if i < t:
                t = i
        #print(t) 
        s=0
        c=-1
        n = []
        for i in arr:
            c+=1
            if i == t:
                n.append(c)
                s+=1
       
        if s > 1:
            f = 999999
            for i in n:
                if f > brr[i]:
                    f = brr[i]
                    a=i
            # i = brr.index(f)
            
            print("%d %d"%(arr[a], brr[a]))
            # if i == t:
            #     for j in brr:
        else:
            print("%d %d"%(t, brr[arr.index(t)]))


    except:
        break