n = int(input()) s = set() l = list() for _ in range(n): a, b = input().split() s.add(a) l.append(b) for x in b: if x not in s: print(x)