#include <bits/stdc++.h>
using namespace std;
const int N = 2750135;
const int mod = 1e9 + 7;
int pos[N], pr[N], cnt, a[N], b[N];
bool d[N];
vector<int> A;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  for (int i = 2; i <= 2750131; ++i) {
    if (!pr[i]) {
      pos[i] = ++cnt;
      if (i * 1ll * i <= 2750131) {
        for (int j = i * i; j <= 2750131; ++j) {
          if (!pr[j]) pr[j] = i;
          j += i - 1;
        }
      }
    }
  }
  int n;
  cin >> n;
  for (int i = 1; i <= 2 * n; ++i) cin >> a[i];
  sort(a + 1, a + 1 + 2 * n);
  for (int i = 2 * n; i >= 1; --i) {
    if (b[a[i]]) {
      d[i] = 1;
      --b[a[i]];
      continue;
    }
    if (pr[a[i]]) {
      d[i] = 1;
      A.push_back(a[i]);
      ++b[a[i] / pr[a[i]]];
    }
  }
  for (int i = 2 * n; i >= 1; --i) {
    if (d[i]) continue;
    if (b[a[i]]) {
      --b[a[i]];
      continue;
    }
    A.push_back(pos[a[i]]);
    ++b[pos[a[i]]];
  }
  for (auto to : A) cout << to << ' ';
  return 0;
}
