#include <bits/stdc++.h>
using namespace std;
const int N = 3e6 + 5;
int prime[N];
vector<int> P;
void init() {
  memset(prime, -1, sizeof(prime));
  P.clear();
  for (int i = 2; i < N; i++) {
    prime[i] = max(prime[i], 1);
    if (prime[i] == 1) P.push_back(i);
    for (int j = 2 * i; j < N; j += i) {
      prime[j] = max(prime[i], i);
    }
  }
}
int a[200005], b[400005];
map<int, int> ma;
map<int, int> has, ned;
void solve() {
  ma.clear();
  ned.clear();
  has.clear();
  init();
  for (int i = 0; i < P.size(); i++) ma[P[i]] = i + 1;
  int n;
  scanf("%d", &n);
  for (int i = 0; i < 2 * n; i++) {
    scanf("%d", &b[i]);
    if (has.find(b[i]) == has.end()) has[b[i]] = 0;
    has[b[i]]++;
    ned[b[i]] = 0;
  }
  sort(b, b + 2 * n);
  int N = 0;
  for (int i = 2 * n - 1; i >= 0; i--) {
    if (ned[b[i]] > 0) {
      ned[b[i]]--;
      continue;
    }
    if (prime[b[i]] == 1) {
      int t = ma[b[i]];
      a[N++] = t;
      ned[t]++;
    } else {
      int t = prime[b[i]];
      a[N++] = b[i];
      ned[t]++;
    }
  }
  for (int i = 0; i < n; i++) printf("%d ", a[i]);
  printf("\n");
}
int main() {
  solve();
  return 0;
}
