#include <bits/stdc++.h>
using namespace std;
const long long mx = 2750132;
long long done[mx];
vector<long long> pr;
long long idx[mx];
multiset<long long, greater<long long> > a;
long long dv(long long k) {
  for (long long i = 2; i * i <= k; i++) {
    if (k % i == 0) return k / i;
  }
}
int main() {
  {
    ios ::sync_with_stdio(false);
    cin.tie(0);
  };
  ;
  pr.push_back(0);
  long long i, j, k, m, n, p, q;
  cin >> n;
  for (i = 0; i < 2 * n; i++) {
    cin >> k;
    a.insert(k);
  }
  for (i = 0; i < mx; i++) {
    done[i] = true;
    idx[i] = -1;
  }
  done[0] = 0;
  done[1] = 0;
  for (i = 2; i * i < mx; i++) {
    if (!done[i]) continue;
    for (j = i * i; j < mx; j += i) {
      done[j] = 0;
    }
  }
  for (i = 2; i < mx; i++) {
    if (done[i]) pr.push_back(i);
  }
  for (i = 0; i < pr.size(); i++) {
    idx[pr[i]] = i;
  }
  for (i = 4; i < mx; i++) {
    if (idx[i] == -1) {
      idx[i] = dv(i);
    }
  }
  while (!a.empty()) {
    k = *a.begin();
    p = idx[k];
    if (done[k])
      cout << p << " ";
    else
      cout << k << " ";
    auto it = a.find(p);
    a.erase(it);
    a.erase(a.begin());
  }
  cout << "\n";
}
