#include <bits/stdc++.h>
int pp[200000 + 1], qq[2750131 + 1];
void init() {
  int a, b, k;
  k = 0;
  for (a = 2; a <= 2750131; a++) {
    if (qq[a]) continue;
    pp[++k] = a;
    for (b = a; b <= 2750131; b += a)
      if (!qq[b]) qq[b] = a;
  }
}
int main() {
  static int kk[2750131 + 1];
  int n, a, b;
  init();
  scanf("%d", &n), n *= 2;
  while (n--) {
    scanf("%d", &b);
    kk[b]++;
  }
  for (b = 2750131; b >= 0; b--) {
    if (qq[b] == b || kk[b] == 0) continue;
    a = b / qq[b];
    while (kk[b]--) {
      printf("%d ", b);
      kk[a]--;
    }
  }
  for (b = 0; b <= 2750131; b++) {
    if (qq[b] != b || kk[b] == 0) continue;
    a = pp[b];
    while (kk[b]--) {
      printf("%d ", b);
      kk[a]--;
    }
  }
  printf("\n");
  return 0;
}
