l=lambda: map(int,raw_input().split())
def gcd(a, b):
    while b!=0:
        a,b=b,a%b
    return a
n=input()
a=l()
d={}
for v in a:
    d[v]=d.get(v,0)+1
ans=[]
for i in range(n):
    maxkey= max(d.keys())
    d[maxkey]-=1
    if d[maxkey]<=0:
        d.pop(maxkey)
    for x in ans:
        val=gcd(maxkey,x)
        d[val]-=2
        if d[val]<=0:
            d.pop(val)
    ans.append(maxkey)
print ' '.join(map(str,ans))