pl = [input()] for _ in range(int(input())): rnd = input().split() if pl[0] in rnd: rnd.remove(pl[0]) pl = rnd print(pl[0])