students = {} num = int(input()) for k in num: line = input().split() cheater = line[0] writer = line[1] if not cheater in students: students[cheater] = True else: students[cheater] = True if not writer in students: students[writer] = False for key, value in students.iteritems(): if value: print(key)