from sys import stdin n=int(stdin.readline()) l=[stdin.readline().split() for _ in [0]*n] b,a=[i for i in zip(*l)] a=sorted(set(a)-set(b),key=a.index) print('\n'.join(a))