import sys

n = input()
l = raw_input().split()
a = [int(i) for i in l]
a.sort(reverse=True)
d = {}

for i in a:
	if d.has_key(i):
		d[i]+=1
	else:
		d[i]=1

now = [0]

def getNext(now):
	while d[a[now[0]]]==0:
		now[0]+=1
	d[a[now[0]]]-=1
	return a[now[0]]

def gcd(a,b):
	if a%b==0: return b
	return gcd(b,a%b)

ans = [getNext(now)]


for i in xrange(n-1):
	x = getNext(now)
	for y in ans:
		d[gcd(x,y)]-=2
	ans.append(x)
res = ""
for i in ans: res+=str(i) + ' '
print res
