from sys import stdin,stdout
from math import gcd
input = stdin.readline
def main():
    #t = int(input())
    t=1
    for z in range(t):
        n = int(input())
        #n, m  = map(int,input().split())
        ai = list(map(int,input().split()))
        if n == 1:
            print(ai[0])
            return
        ai.sort()
        ar2 = [ai[-1],ai[-2]]
        d = {}
        d[ai[-1]] = 0
        d[ai[-2]] = 0
        d[gcd(ai[-1],ai[-2])] = 2
        for i in range(n**2-3,-1,-1):
            if ai[i] in d:
                if d[ai[i]] == 0:
                    for num in ar2:
                        temp = gcd(num,ai[i])
                        if temp in d:
                            d[temp] += 2
                        else:
                            d[temp] = 2
                    ar2 += [ai[i]]
                else:
                    d[ai[i]] -= 1
            else:
                for num in ar2:
                    temp = gcd(num,ai[i])
                    if temp in d:
                        d[temp] += 2
                    else:
                        d[temp] = 2
                ar2 += [ai[i]]
                
        print(*ar2)
main()
