from operator import itemgetter, attrgetter, methodcaller
from collections import Counter
from fractions import gcd

n = int(raw_input())
nods = map(int, raw_input().split(' ') )
cnt = Counter(nods)
cntList = sorted( cnt.items(), key=itemgetter(0), reverse=True )
#print cnt

def addNum(num, nums, cnt):
    for n in nums:
        g = gcd(n, num)
        cnt[g] -= 2
    cnt[num] -= 1
    nums.append(num)

nums = []

for c in cntList:
    if len(nums) >= n: break
    num = c[0]
    while cnt[num] >= 1:
        addNum(num, nums, cnt)
    
    

print " ".join( map(str, nums) )