#include <bits/stdc++.h>
using namespace std;
bool pr[3000005];
vector<int> prime;
int id[3000005];
int mx_div[3000005];
void seive() {
  memset(pr, true, sizeof(pr));
  pr[1] = pr[0] = false;
  int cnt = 1;
  for (int i = 2; i < 3000005; i++) {
    if (!pr[i]) continue;
    prime.push_back(i);
    id[i] = cnt++;
    for (int j = i * 2; j < 3000005; j += i) {
      pr[j] = false;
    }
  }
}
int n, b[3000005];
multiset<int> myset;
vector<int> ans;
int main() {
  int i, j;
  seive();
  for (i = 2; i <= 200002; i++) {
    for (j = 2; j * j <= i; j++) {
      if (i % j == 0) {
        mx_div[i] = max(j, i / j);
        break;
      }
    }
  }
  scanf("%d", &n);
  for (i = 1; i <= 2 * n; i++) {
    scanf("%d", &b[i]);
    myset.insert(b[i]);
  }
  while (myset.size() > 0) {
    int now = *myset.rbegin();
    if (pr[now]) {
      int pos = id[now];
      ans.push_back(pos);
      myset.erase(myset.find(now));
      myset.erase(myset.find(pos));
    } else {
      int x = mx_div[now];
      ans.push_back(now);
      myset.erase(myset.find(now));
      myset.erase(myset.find(x));
    }
  }
  for (auto xx : ans) printf("%d ", xx);
  printf("\n");
}
