def getDictionary(myList):
    myDict = {}
    for i in range(0, len(myList)):
        if (myList[i] in myDict):
            myDict[myList[i]] = myDict[myList[i]] + 1;
        else:
            myDict[myList[i]] = 1;
    return myDict
 
def counting(sizeOfMother, myDict):
    winTable = []
    for i in range(0, sizeOfMother):
        x = next(iter(myDict.keys()))
 
        # Usun ten element
        if (myDict[x] > 1):
            myDict[x] = myDict[x] - 1;
        else:
            del myDict[x]
 
        for j in range(0, len(winTable)):
            gcd = searchNWD(x, winTable[j])
            # Usun ten element
            if (myDict[gcd] <= 2):
                del myDict[gcd]
            else:
                myDict[gcd] = myDict[gcd] - 2;
                
        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)
myDictG = getDictionary(numberInMotherG)

w = counting(sizeOfMotherG, myDictG)
 
for i in range(0, sizeOfMotherG):
    print(w[i], end=" ")