#include <bits/stdc++.h>
const int N = 4e5 + 7, M = 2760000;
int a[N], prime[N], m, flg[M], f[M], x[N], y[N], nn, mm, tot[M];
template <typename Tp>
inline void read(Tp &x) {
  x = 0;
  bool f = true;
  char ch = getchar();
  for (; ch < '0' || ch > '9'; ch = getchar()) f ^= ch == '-';
  for (; ch >= '0' && ch <= '9'; ch = getchar()) x = x * 10 + (ch ^ 48);
  x = f ? x : -x;
}
inline void primes() {
  m = 0;
  std::fill(flg + 1, flg + 2750132, true);
  for (int i = 2; i <= 2750131; i++) {
    if (flg[i]) {
      prime[++m] = i;
      f[i] = i;
    }
    for (int j = 1; j <= m && i * prime[j] <= 2750131; j++) {
      flg[i * prime[j]] = false;
      f[i * prime[j]] = std::min(f[i], prime[j]);
      if (!(i % prime[j])) break;
    }
  }
}
int main() {
  int n;
  read(n);
  n <<= 1;
  for (int i = 1; i <= n; i++) read(a[i]);
  std::sort(a + 1, a + n + 1);
  primes();
  for (int i = 1; i <= n; i++)
    if (flg[a[i]])
      x[++nn] = a[i];
    else
      y[++mm] = a[i];
  for (int i = mm; i; i--) {
    if (tot[y[i]]) {
      tot[y[i]]--;
      continue;
    }
    printf("%d ", y[i]);
    tot[y[i] / f[y[i]]]++;
  }
  for (int i = 1; i <= nn; i++) {
    if (tot[x[i]]) {
      tot[x[i]]--;
      continue;
    }
    printf("%d ", x[i]);
    tot[prime[x[i]]]++;
  }
  return 0;
}
