#include <bits/stdc++.h>
using namespace std;
int n, t;
int a[1000000];
int b[1000000];
multiset<int> q;
int nod(int x, int y) {
  if (y == 0) {
    return x;
  } else {
    return nod(y, x % y);
  }
}
int main() {
  cin >> n;
  for (int i = 0; i < n * n; i++) {
    cin >> a[i];
  }
  sort(a, a + n * n);
  b[0] = a[n * n - 1];
  if (n == 1) {
    cout << b[0];
    return 0;
  }
  b[1] = a[n * n - 2];
  int kol = 2;
  int uk = n * n - 3;
  q.insert(nod(b[0], b[1]));
  while (uk >= 0) {
    if ((q.size() == 0) || (*q.rbegin() != a[uk])) {
      b[kol] = a[uk];
      for (int i = 0; i < kol; i++) {
        q.insert(nod(b[i], b[kol]));
      }
      kol++;
      uk--;
    } else {
      uk -= 2;
      q.erase(q.find(*q.rbegin()));
    }
  }
  for (int i = 0; i < n; i++) {
    cout << b[i] << ' ';
  }
  return 0;
}
