from collections import defaultdict

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

def main():
    n = int(input())
    numbers = list(map(int, input().split()))
    numbers.sort()

    answer = [numbers[-1]]
    del numbers[-1]

    how_many = defaultdict(int)    
    for x in numbers:
        how_many[x] += 1
    
    for _ in range(n-1):
        max_value = 0
        for number in how_many.keys():
            max_value = max(max_value, number)
        how_many[max_value] -= 1
        if how_many[max_value] == 0:
            del how_many[max_value]
        for element in answer:
            key = gcd(element,max_value)
            how_many[key] -= 2
            if how_many[key] == 0:
                del how_many[key]
        answer.insert(0, max_value)
    for a in answer:
        print(a, end = " ")

main()
