#include <bits/stdc++.h>
using namespace std;
const int BND = 2750131 + 99;
const int MX = 2E5 + 99;
int n;
int b[2 * MX];
vector<int> p;
int min_p[BND];
void sieve() {
  for (int i = 2; i < BND; i++) min_p[i] = i;
  for (int i = 2; i * i < BND; i++) {
    for (int j = i; i * j < BND; j++) {
      min_p[i * j] = min(min_p[i * j], min(min_p[i], min_p[j]));
    }
  }
  p.push_back(1337);
  for (int i = 2; i < BND; i++) {
    if (min_p[i] == i) p.push_back(i);
  }
  for (int i = 1; i < 20; i++) {
    ;
  }
}
bool have(map<int, int>& M, int val) { return M.find(val) != M.end(); }
void dec(map<int, int>& M, int val) {
  assert(M.find(val) != M.end());
  M[val]--;
  if (M[val] == 0) M.erase(val);
}
void dbgM(map<int, int>& M, string name) {
  return;
  cout << name << endl;
  for (auto it : M) {
    cout << it.first << ' ' << it.second << endl;
  }
  cout << "-------------" << endl;
}
vector<int> solve() {
  vector<int> result;
  map<int, int> primes, composites;
  for (int i = 0; i < 2 * n; i++) {
    int bb = b[i];
    if (min_p[bb] == bb)
      primes[bb]++;
    else
      composites[bb]++;
  }
  dbgM(primes, "primes");
  dbgM(composites, "composites");
  while (!composites.empty()) {
    ;
    auto it = composites.end();
    it--;
    int pR = it->first;
    dec(composites, pR);
    int R = pR / min_p[pR];
    if (min_p[R] == R)
      dec(primes, R);
    else
      dec(composites, R);
    ;
    result.push_back(pR);
  }
  dbgM(primes, "primes");
  dbgM(composites, "composites");
  while (!primes.empty()) {
    ;
    auto it = primes.begin();
    int pp = it->first;
    int pp_pp = p[pp];
    ;
    ;
    dec(primes, pp);
    dec(primes, pp_pp);
    result.push_back(pp);
  }
  return result;
}
int main() {
  sieve();
  cin >> n;
  for (int i = 0; i < 2 * n; i++) cin >> b[i];
  auto res = solve();
  for (auto a : res) cout << a << ' ';
  return 0;
}
