#include <bits/stdc++.h>
using namespace std;
const long long M = 3000400, N = 3000400, MOD = 1e9 + 7, OO = 1e16;
long long n, a[M + 4], vis[N + 4], vis1[M + 4], GD[M + 4], vis2[N + 4];
vector<long long> v, vv;
void seive(long long num) {
  for (long long i = 2; i * i < num; i++) {
    vis[1] = vis[0] = 1;
    if (!vis[i]) {
      for (long long j = i * i; j < num; j += i) vis[j] = 1;
    }
  }
  for (int i = 2; i <= num; i++) {
    if (!vis[i]) v.push_back(i);
  }
}
void GDiv() {
  for (long long i = 1; i < 2750133; i++) {
    for (long long j = i + i; j < 2750133; j += i) GD[j] = i;
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  ;
  v.push_back(0);
  seive(N);
  GDiv();
  cin >> n;
  n *= 2;
  long long mx = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    vis1[a[i]]++;
    mx = max(mx, a[i]);
  }
  for (int i = mx; i >= 0; i--) {
    while (vis1[i] > 0) {
      long long k = GD[i];
      if (k == 1) {
        auto ans = lower_bound(v.begin(), v.end(), i) - v.begin();
        vis1[ans]--;
        vv.push_back(ans);
      } else {
        vv.push_back(i);
        vis1[k]--;
      }
      vis1[i]--;
    }
  }
  for (int i = 0; i < vv.size(); i++) cout << vv[i] << " ";
  return 0;
}
