#include <bits/stdc++.h>
const int maxn = 3e6 + 10;
using namespace std;
bool vis[maxn];
int pri[maxn], top;
int n;
int a[maxn], b[maxn];
int cnt[maxn];
int usd[maxn];
int ans;
int pos[maxn];
void init() {
  vis[1] = 1;
  for (int i = 2; i < maxn; ++i) {
    if (!vis[i]) {
      pri[++top] = i;
    }
    for (int j = 1; j <= top && 1LL * i * pri[j] < maxn; ++j) {
      vis[i * pri[j]] = 1;
      if (i % pri[j] == 0) break;
    }
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= 2 * n; ++i) scanf("%d", b + i);
  sort(b + 1, b + 1 + 2 * n, greater<int>());
  init();
  for (int i = 1; i <= 2 * n; ++i) {
    cnt[b[i]]++;
  }
  for (int i = 1; i <= top; ++i) pos[pri[i]] = i;
  for (int i = 1; i <= 2 * n; ++i) {
    if (usd[b[i]]) {
      --usd[b[i]];
      continue;
    }
    if (!vis[b[i]]) {
      a[++ans] = pos[b[i]];
      usd[pos[b[i]]]++;
    } else {
      int mx = 0;
      for (int j = 2; 1LL * j * j <= b[i]; ++j) {
        if (b[i] % j == 0) mx = max(mx, max(b[i] / j, j));
      }
      usd[mx]++;
      a[++ans] = b[i];
    }
  }
  for (int i = 1; i <= ans; ++i) printf("%d ", a[i]);
  return 0;
}
