import math
from collections import Counter

n=int(input())
count_=Counter(map(int,input().split()))

ans=[]
for i in range(n):
    big = max(count_)
    count_[big]-=1
    for other in ans:
        a=math.gcd(other,big)#;b= math.gcd(other,big)
        count_[a]-=2
    ans.append(big)
    count_+=Counter()
    #print(count_)
print(*ans)#,count_)