#include <bits/stdc++.h>
using namespace std;
multiset<long long> b;
long long n, x, top, maxdel[3000005];
vector<long long> simp, ans;
bool flags[3000005];
long long binpoisk(long long key) {
  long long l = 0, r = (long long)simp.size() - 1;
  while (r - l > 1) {
    long long m = l + (r - l) / 2;
    if (simp[m] <= key)
      l = m;
    else
      r = m;
  }
  if (simp[l] == key) return l;
  return r;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= (2 * n); i++) {
    cin >> x;
    b.insert(x);
  }
  flags[0] = flags[1] = true;
  for (long long i = 2; i <= 2750131; i++)
    if (flags[i] == false) {
      if (i * i <= 2750131)
        for (long long j = i * i; j <= 2750131; j += i) {
          flags[j] = true;
          if (maxdel[j] == 0) maxdel[j] = (j / i);
        }
      simp.push_back(i);
    }
  while (!b.empty()) {
    x = *b.rbegin();
    if (flags[x] == false) {
      b.erase(b.find(x));
      top = binpoisk(x);
      b.erase(b.find(top + 1));
      ans.push_back(top + 1);
    } else {
      ans.push_back(x);
      b.erase(b.find(x));
      b.erase(b.find(maxdel[x]));
    }
  }
  for (int i = 0; i < n; i++) cout << ans[i] << " ";
  return 0;
}
