#include <bits/stdc++.h>
using namespace std;
const int maxn = 3000005;
const double pi = acos(-1.0);
const long long mod = 1000000007;
bool v[maxn];
int pn = 0, p[maxn], id[maxn];
int cnt[maxn] = {0};
int n, a[maxn];
int mm(int x) {
  for (int j = 0; j < pn; j++)
    if (x % p[j] == 0) return x / p[j];
}
int main() {
  int i, j;
  memset(v, true, sizeof(v));
  v[0] = v[1] = 1;
  for (i = 2; i < maxn; i++) {
    if (v[i]) p[pn++] = i, id[i] = pn;
    for (j = 0; j < pn && p[j] * 1LL * i < maxn; j++) {
      v[p[j] * i] = 0;
      if (i % p[j] == 0) break;
    }
  }
  scanf("%d", &n);
  for (i = 0; i < n * 2; i++) scanf("%d", a + i);
  sort(a, a + n * 2);
  for (i = 2 * n - 1; i >= 0; i--) {
    if (cnt[a[i]] > 0) {
      --cnt[a[i]];
      continue;
    }
    if (v[a[i]]) {
      printf("%d ", id[a[i]]);
      cnt[id[a[i]]]++;
    } else {
      printf("%d ", a[i]);
      cnt[mm(a[i])]++;
    }
  }
  printf("\n");
  return 0;
}
