#include <bits/stdc++.h>
using namespace std;
int p[2750200], cnt[2750200];
vector<int> pr;
multiset<int> pri, nop;
void sieve() {
  for (int i = 2; i <= 2750131; i++) {
    if (p[i]) continue;
    for (int j = i + i; j <= 2750131; j += i) {
      if (p[j] == 0) p[j] = i;
    }
    pr.push_back(i);
  }
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  pr.push_back(-1);
  int n, x, mx = 0;
  sieve();
  cin >> n;
  for (int i = 0; i < 2 * n; i++) {
    cin >> x;
    cnt[x]++;
    mx = max(x, mx);
  }
  for (int i = mx; i >= 2; i--) {
    if (cnt[i] == 0 || p[i] == 0) continue;
    int great = i / p[i];
    for (int j = 0; j < cnt[i]; j++) cnt[great]--;
  }
  for (int i = 2; i <= mx; i++) {
    if (p[i] || cnt[i] == 0) continue;
    for (int j = 0; j < cnt[i]; j++) cnt[pr[i]]--;
  }
  for (int i = 2; i <= mx; i++)
    while (cnt[i]--) cout << i << " ";
  return 0;
}
