#include <bits/stdc++.h>
using namespace std;
const int MAXVAL = 2750131 + 10;
const int MAXN = 5e5 + 10;
int N, b[MAXN], idx[MAXVAL], tag[MAXVAL], mx[MAXVAL];
vector<int> primes;
int main() {
  for (int i = 2; i < MAXVAL; ++i) {
    if (!tag[i]) primes.push_back(i), idx[i] = primes.size();
    for (int j : primes) {
      if (j * i >= MAXVAL) break;
      tag[j * i] = true, mx[j * i] = i;
      if (i % j == 0) break;
    }
  }
  scanf("%d", &N);
  multiset<int, greater<int> > S;
  vector<int> ans;
  for (int i = (0), iend = (N << 1); i < iend; ++i) {
    int x;
    scanf("%d", &x);
    S.insert(x);
  }
  while (!S.empty()) {
    int val = *S.begin();
    S.erase(S.begin());
    if (tag[val]) {
      ans.push_back(val);
      S.erase(S.find(mx[val]));
    } else {
      ans.push_back(idx[val]);
      S.erase(S.find(idx[val]));
    }
  }
  for (int i : ans) printf("%d ", i);
  return 0;
}
