import math,sys
#from itertools import permutations, combinations;import heapq,random;
from collections import defaultdict,deque
import bisect as bi
def yes():print('YES')
def no():print('NO')
def I():return (int(sys.stdin.readline()))
def In():return(map(int,sys.stdin.readline().split()))
def Sn():return sys.stdin.readline().strip()
#sys.setrecursionlimit(1500)
def dict(a):
    d={} 
    for x in a:
        if d.get(x,-1)!=-1:
            d[x]+=1
        else:
            d[x]=1
    return d
def find_gt(a, x):
    'Find leftmost value greater than x'
    i = bi.bisect_left(a, x)
    if i != len(a):
        return i
    else:            
        return -1
        
def main():
    try:
        n=I()
        l=list(In())
        d,s={},[]
        for x in l:
            if d.get(x,-1)!=-1:
                d[x]+=1
            else:
                d[x]=1
        ans=[]
        ans.append(max(l))
        # d.pop(ans[0])
        d[ans[0]]-=1
        if d[ans[0]]==0:
            d.pop(ans[0])
        for i in range(n-1):
            mx=0
            for x in d.keys():
                mx=max(mx,x)
            for x in ans:
                z=math.gcd(x,mx)
                d[z]-=2
                if d[z]==0:
                    d.pop(z)
            d[mx]-=1
            if d[mx]==0:
                d.pop(mx)
            ans.append(mx)
        ans.sort()
        print(*ans)
    except:
        pass
        
M = 998244353
P = 1000000007
 
if __name__ == '__main__':
    # for _ in range(I()):main()
    for _ in range(1):main()
#        *******************    All The Best    *******************   #