n=input()
a=map(int,raw_input().split())
def gcd(a,b):
    if not b: return a
    return gcd(b, a%b)
a.sort()
ans=[0]*n
ans[0]=a[-1]
k=1
d=dict()
for x in a[:-1]:
    d[x]=d.get(x,0)+1
for v in sorted(set(a[:-1]), reverse=True):
    while d[v]:
        d[v]-=1
        ans[k]=v
        for x in ans[:k]:
            g=gcd(v,x)
            d[g]=d[g]-2
        k+=1
print ' '.join(map(str,ans))