from collections import Counter


def gcd(a, b): return a if b == 0 else gcd(b, a % b)


n = int(input())
count = Counter()
for e in map(int, input().split()):
    count[e] += 1
res = []
while sum(count.values()) > 0:
    cur = max(count.keys())
    count[cur] -= 1
    if count[cur] == 0:
        del count[cur]
    for e in res:
        g = gcd(cur, e)
        count[g] -= 2
        if count[g] == 0:
            del count[g]
    res.append(cur)
print(*res)