n=int(input()) AB=[list(map(str,input().split())) for _ in range(n)] cheater,allperson=[],[] for a,b in AB: cheater.append(a) allperson.append(a) allperson.append(b) nocheater=set(allperson) for c in cheater: if c in nocheater: nocheater.remove(c) print(*nocheater,sep="\n")