#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e6 + 7;
int check[maxn], tot, prime[maxn], reprime[maxn], maxfac[maxn];
int n, a[maxn];
unordered_map<int, int> num;
void sushu() {
  for (int i = 2; i < maxn; i++) {
    if (!check[i]) {
      prime[++tot] = i;
      reprime[i] = tot;
    }
    for (int j = 1; j <= tot; j++) {
      if (i * prime[j] >= maxn) break;
      check[i * prime[j]] = 1;
      maxfac[i * prime[j]] = i;
      if (i % prime[j] == 0) break;
    }
  }
}
int main() {
  sushu();
  scanf("%d", &n);
  vector<int> ans(n + 5);
  n = 2 * n;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    num[a[i]]++;
  }
  sort(a + 1, a + n + 1);
  int cnt = 0;
  for (int i = n; i >= 1; i--) {
    if (num[a[i]] > 0 && (!check[a[i]])) {
      num[a[i]]--;
      num[reprime[a[i]]]--;
      ans[++cnt] = reprime[a[i]];
    } else if (num[a[i]] > 0) {
      num[a[i]]--;
      num[maxfac[a[i]]]--;
      ans[++cnt] = a[i];
    }
  }
  for (int i = 1; i <= n / 2; i++) {
    printf("%d%c", ans[i], i == n / 2 ? '\n' : ' ');
  }
  return 0;
}
