def counting(sizeOfMother, numberInMother):
    winTable = []
    for i in range(0, sizeOfMother):
        x = numberInMother[0]
        numberInMother.remove(x)
        for j in range(0, len(winTable)):
            gcd = searchNWD(x, winTable[j])
            numberInMother.remove(gcd)
            numberInMother.remove(gcd)
        print(numberInMother)
        winTable.append(x)
    return winTable

def searchNWD(a, b):
    temporary = 0
    while(a != 0) and (b != 0):
        if(a > b):
            a = a % b
        else:
            b = b % a
    if(a > 0):
        return a
    else:
        return b

######################
sizeOfMotherG = int(input())
numberInMotherG = list(map(int, input().split()))
numberInMotherG.sort(reverse=True)
w = counting(sizeOfMotherG, numberInMotherG)
print(str(w))