#include <bits/stdc++.h>
using namespace std;
long long pri[3000005];
bool prim[3000005];
long long val[3000005];
long long b[3000005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  long long k = 1;
  for (long long i = 2; i * i <= 2750131; i++) {
    if (prim[i] == false) {
      for (long long j = 2; i * j <= 2750131; j++) prim[i * j] = true;
    }
  }
  for (long long i = 2; i <= 2750131; i++) {
    if (prim[i] == false) {
      val[i] = k;
      k++;
    }
  }
  vector<long long> ans, v;
  for (long long i = 0; i < 2 * n; i++) {
    long long temp;
    cin >> temp;
    b[temp]++;
    v.push_back(temp);
  }
  sort(v.begin(), v.end(), greater<int>());
  for (long long i = 0; i < 2 * n; i++) {
    if (b[v[i]] > 0) {
      if (prim[v[i]] == false && b[val[v[i]]] > 0) {
        ans.push_back(val[v[i]]);
        b[v[i]]--;
        b[val[v[i]]]--;
      } else {
        long long sq = sqrt(v[i]);
        for (long long j = 2; j <= sq; j++) {
          if (v[i] % j == 0) {
            if (b[v[i] / j] > 0) {
              b[v[i] / j]--;
              b[v[i]]--;
              ans.push_back(v[i]);
              break;
            }
          }
        }
      }
    }
  }
  for (long long i = 0; i < ans.size(); i++) cout << ans[i] << " ";
  return 0;
}
