def gcd(x,y):
   return x if y==0 else  gcd(y,x%y)

n = input()
a = map(int , raw_input().split())
a = sorted(a)
b = {}
for x in a:
    b[x] = b.get(x,0) + 1
ans = []
while(len(b)):
    x = max(b);
    b[x]-=1
    if(b[x]==0):
        b.pop(x)
    for y in ans:
#        print('g: ',y,x,  gcd(y,x), b)
        b[gcd(y,x)]-=2
        if(b[gcd(y,x)]==0):
            b.pop(gcd(y,x))
    ans+=[x]
    print x,
