from sys import stdin,stdout
from math import gcd
from collections import Counter
nmbr = lambda: int(stdin.readline())
lst = lambda: list(map(int,stdin.readline().split()))
for _ in range(1):#nmbr()):
    n=nmbr()
    a=sorted(lst())
    d=Counter(a)
    f=1
    ans=[]
    while f:
        mx=max(d)
        # print(d,mx)
        # ans+=[mx]
        d[mx]-=1
        if d[mx] == 0: del d[mx]
        for v in ans:
            g=gcd(v,mx)
            d[g]-=2
            if d[g]==0:del d[g]
        ans+=[mx]
        if len(ans)==n:f=0
    print(*ans)