import math
from collections import Counter
n = int(input())
a = Counter(map(int, input().rstrip().split()))
li = []
for i in range(n):
    maxm = max(a)
    a[maxm] -= 1
    for x in li:
        a[math.gcd(x, maxm)] -= 2
    li += [maxm]
    a += Counter()
print(*li)