#include<bits/stdc++.h>
#include<string.h>
using namespace std;

#define ll long long
#define sci(x) scanf("%d",&x)
#define scl(x) scanf("%I64d",&x)
#define scd(x) scanf("%lf",&x)
#define pfi(x) printf("%d",x)
#define pfl(x) printf("%I64d",x)
#define pfd(x) printf("%lf",x)
#define pfc(x) printf("Case %d: ",x)
#define ps printf(" ")
#define pn printf("\n")
//memset(a, 0, sizeof(a));
vector<int>arr;
vector<int>::iterator it;
vector<int>::iterator it2;
int main()
{
    int n,max1=0,y;
    sci(n);
    int a[505]={0};
    for(int i=0;i<n*n;i++)
    {
        sci(y);
        arr.push_back(y);
    }
    int k=0;
    while(!arr.empty())
    {
        max1=0;

        for(it=arr.begin();it!=arr.end();it++)
        {
            if(max1<*it)
            {
                max1=*it;
                it2=it;
            }
        }
        a[k]=max1;

        //printf("%d\n",max1);
        arr.erase(it2);
        //for(int i=0;i<n*n-1;i++)
        //{
        //    pfi(arr[i]);ps;
        //}
        //pn;printf("dffd\n");
        k++;
        if(k==1)
            continue;
        //cout<<"LL "<<k<<"\n";
        for(int i=0;i<k-1;i++)
        {
            int f=__gcd(max1,a[i]);
           // cout<<f;
           // cout<<arr.size()<<"\n";
            for(int k=0;k<arr.size();k++)
            {
                //cout<<"Op "<<*it<<"\n";
                //cout<<"Size "<<arr.size()<<"\n";
                if(arr[k]==f){
                    arr.erase(arr.begin()+k);
                   // cout<<"YY\n";
                    }

                // cout<<"Size "<<arr.size()<<"\n";
            }
            //cout<<"UU\n";
        }
       // cout<<"HH \n";
    }
    for(int i=0;i<n;i++)
    {
        pfi(a[i]);ps;
    }
    pn;
    return 0;
}

/*4
2 1 2 3 4 3 2 6 1 1 2 2 1 2 3 2
*/

