def gcd(x,y):
  return x if not y else gcd(y,x%y)
n=input()
a=sorted(map(int,raw_input().split()))
c={}
for x in a:
  c[x]=c.get(x,0)+1
b=[]
while a:
  x=a.pop()
  if c[x]:
    print x,
    c[x]-=1
    b+=[x]
    while a and not c[a[-1]]:
      a.pop()
    if a:
      x=a[-1]
      for y in b:
        c[gcd(x,y)]-=2