#include <bits/stdc++.h>
using namespace std;
using LL = long long;
const int maxn = 3000010;
int n, b;
int pre[maxn], vis[maxn];
vector<int> prime;
struct init {
  init() {
    memset(pre, 0, sizeof pre);
    prime.clear();
    for (int i = 2; i < maxn; i++) {
      if (pre[i] == 0) {
        pre[i] = i;
        prime.emplace_back(i);
      }
      for (int j = 0; j < prime.size() && i * prime[j] < maxn; j++) {
        if (prime[j] > pre[i]) break;
        pre[i * prime[j]] = prime[j];
      }
    }
  }
} init_;
bool ok(int x) {
  if (x == 1) return 0;
  return pre[x] == 0;
}
signed main() {
  while (cin >> n) {
    memset(vis, 0, sizeof vis);
    for (int i = 1; i <= 2 * n; i++) {
      scanf("%d", &b);
      vis[b]++;
    }
    for (int i = maxn - 1; i > 1; i--) {
      if (pre[i] == i) continue;
      while (vis[i] > 0) {
        printf("%d ", i);
        vis[i]--;
        vis[i / pre[i]]--;
      }
    }
    for (int i = 2; i < maxn; i++) {
      while (vis[i] > 0) {
        printf("%d ", i);
        vis[i]--;
        vis[prime[i - 1]]--;
      }
    }
    printf("\n");
  }
  return 0;
}
