#include <bits/stdc++.h>
using namespace std;
long long cnt[2750132];
long long pn[2750132];
long long o[2750132];
long long sf[2750132];
void sieve() {
  long long i, j;
  long long cnt1 = 1;
  for (i = 2; i < 2750132; i++) {
    if (o[i] == 1) continue;
    pn[i] = cnt1++;
    for (j = i * i; j < 2750132; j += i) {
      if (o[j] == 0) sf[j] = i;
      o[j] = 1;
    }
  }
}
int main() {
  long long n, i, j, k;
  sieve();
  cin >> n;
  long long b[2 * n];
  for (i = 0; i < 2 * n; i++) {
    cin >> b[i];
    cnt[b[i]]++;
  }
  sort(b, b + 2 * n);
  vector<long long> a;
  for (i = 2 * n - 1; i >= 0; i--) {
    if (cnt[b[i]] == 0) continue;
    if (pn[b[i]] == 0) {
      long long lf = b[i] / sf[b[i]];
      cnt[lf]--;
      cnt[b[i]]--;
      a.push_back(b[i]);
    } else {
      cnt[pn[b[i]]]--;
      cnt[b[i]]--;
      a.push_back(pn[b[i]]);
    }
  }
  for (i = 0; i < a.size(); i++) cout << a[i] << " ";
}
