n = int(input())
l = list(map(int, input().split()))
k = []
for i in range(1, n):
    if l[i] % l[i - 1] == 0:
        k.append(l[i])
print(*k)

588acd48ab9b69f99c67e232dcfdcc68228321d6
<mask token>

<mask token>
for i in range(1, n):
    if l[i] % l[i - 1] == 0:
        k.append(l[i])
print(*k)

n = int(input())
l = list(map(int, input().split()))
k = []
for i in range(1, n):
    if l[i] % l[i - 1] == 0:
        k.append(l[i])
print(*k)
