#include <bits/stdc++.h>
using namespace std;
int b[4 * 100000 + 5];
int ans[2 * 100000 + 5];
int p[2750131 + 5], vis[2750131 + 5], is[2750131 + 5];
int pn;
int prime[2 * 100000 + 5];
bool used[2750131 + 5];
map<int, int> VVV;
void gettable() {
  memset(vis, 0, sizeof(vis));
  pn = 0;
  for (int i = 2; i < 2750131 + 5; i++) {
    if (!vis[i]) p[pn++] = i;
    for (int j = 0; j < pn && i * p[j] < 2750131 + 5; j++) vis[i * p[j]] = 1;
  }
  for (int i = 0; i < pn; i++) is[p[i]] = 1;
}
void init() {
  VVV.clear();
  for (int i = 2; i <= 199999 + 1; i++) {
    if (is[i]) {
      VVV[i] = p[i - 1];
    } else {
      for (int j = 0;; j++) {
        if (i % p[j] == 0) {
          VVV[i] = i / p[j];
          break;
        }
      }
    }
  }
  return;
}
bool cmp(const int &a, const int &b) { return a > b; }
int main() {
  gettable();
  init();
  map<int, int> MMP;
  MMP.clear();
  int n, q;
  scanf("%d", &n);
  for (int i = 1; i <= 2 * n; i++) {
    scanf("%d", &b[i]);
    MMP[b[i]]++;
  }
  sort(b + 1, b + 1 + n * 2, cmp);
  int sum = 0;
  int all = 0;
  for (int i = 1; i <= 2 * n; i++) {
    if (MMP[b[i]] > 0) {
      if (!is[b[i]]) {
        ans[sum++] = b[i];
        MMP[b[i]]--;
        MMP[VVV[b[i]]]--;
      } else if (MMP[b[i]] && MMP[VVV[b[i]]]) {
        printf("%d ", b[i]);
        MMP[b[i]]--;
        MMP[VVV[b[i]]]--;
      }
    }
  }
  for (int i = 0; i < sum; i++) {
    printf("%d ", ans[i]);
  }
  return 0;
}
