x = int(input())
a = sorted(list(map(int, input().split())))
l = []
for i in range(0, len(a) - 1, 1):
    if a[i] == a[i + 1]:
        l.append(a[i])
    else:
        continue
print(*list(set(l)))

493bc946e1abd38512a6afd041e2cd9a932f7781
<mask token>

<mask token>
for i in range(0, len(a) - 1, 1):
    if a[i] == a[i + 1]:
        l.append(a[i])
    else:
        continue
print(*list(set(l)))

x = int(input())
a = sorted(list(map(int, input().split())))
l = []
for i in range(0, len(a) - 1, 1):
    if a[i] == a[i + 1]:
        l.append(a[i])
    else:
        continue
print(*list(set(l)))
