import sys,math as mt
input = sys.stdin.readline
from collections import Counter as cc
I = lambda : list(map(int,input().split()))

n,=I()
l=I()
an=[];rq=cc(l)
for i in range(n):
	mx=max(rq)
	rq[mx]-=1
	for x in an:
		rq[mt.gcd(x,mx)]-=2
	an.append(mx)
	rq+=cc()
print(*an)

