#include <bits/stdc++.h>
using namespace std;
vector<long long> prime;
vector<bool> was(3 * 1000 * 1000 + 1, true);
map<long long, long long> a;
map<long long, long long>::iterator ii;
map<long long, long long>::reverse_iterator jj;
long long big(long long x) {
  for (long long i = 2;; i++) {
    if (x % i == 0) return x / i;
  }
  return 1;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  long long i, j;
  for (i = 0; i < n + n; i++) {
    long long q;
    cin >> q;
    a[q]++;
  }
  for (i = 2; i < 3000000; i++) {
    if (!was[i]) continue;
    long long j = i + i;
    while (j < 3000000) {
      was[j] = false;
      j += i;
    }
  }
  prime.push_back(1);
  for (i = 2; i < 3000000; i++)
    if (was[i]) prime.push_back(i);
  vector<long long> ans;
  vector<long long> clr;
  map<long long, long long> aa = a;
  while (aa.size() > 0) {
    jj = aa.rbegin();
    long long num = jj->first;
    if (was[num])
      aa.erase(num);
    else {
      ans.push_back(num);
      aa[num]--;
      if (aa[num] == 0) aa.erase(num);
      aa[big(num)]--;
      if (aa[big(num)] == 0) aa.erase(big(num));
    }
  }
  for (i = 0; i < ans.size(); i++) {
    long long cur = ans[i];
    a[cur]--;
    if (a[cur] <= 0) a.erase(cur);
    long long next = big(cur);
    a[next]--;
    if (a[next] <= 0) a.erase(next);
  }
  while (a.size()) {
    ii = a.begin();
    ans.push_back(ii->first);
    long long num = ii->first;
    a[num]--;
    if (a[num] == 0) a.erase(num);
    long long next = prime[num];
    a[next]--;
    if (a[next] == 0) a.erase(next);
  }
  for (i = 0; i < ans.size(); i++) cout << ans[i] << " ";
  return 0;
}
