#include <bits/stdc++.h>
using namespace std;
const int MX = 2750131;
int a[MX + 111], grdiv[MX + 110], isp[MX + 111], cnt[MX + 111];
int pr[MX + 111];
bool P(int n) { return !isp[n]; }
int Gr(int n) {
  vector<int> v;
  for (long long i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      n /= i;
      v.push_back(i);
    }
  }
  if (n > 1) v.push_back(n);
  sort(v.begin(), v.end());
  int ret = 1;
  for (int i = 1; i < v.size(); i++) ret *= v[i];
  return ret;
}
void solve() {
  int N;
  scanf("%d", &N);
  for (int i = 0; i < N * 2; i++) scanf("%d", &a[i]), cnt[a[i]]++;
  vector<int> res;
  sort(a, a + N * 2, greater<int>());
  for (int i = 0; i < N * 2; i++) {
    if (P(a[i]))
      grdiv[a[i]] = 1;
    else
      grdiv[a[i]] = Gr(a[i]);
    if (P(a[i]) || cnt[a[i]] == 0) continue;
    cnt[a[i]]--;
    cnt[grdiv[a[i]]]--;
    res.push_back(a[i]);
  }
  reverse(a, a + N * 2);
  for (int i = 0; i < N * 2; i++) {
    if (!P(a[i]) || cnt[a[i]] == 0) continue;
    cnt[a[i]]--;
    cnt[pr[a[i] - 1]]--;
    res.push_back(a[i]);
  }
  for (int i = 0; i < res.size(); i++) cout << res[i] << " ";
}
int main() {
  isp[0] = isp[1] = 1;
  int sz = 0;
  for (int i = 2; i <= MX + 100; i++) {
    if (isp[i]) continue;
    pr[sz++] = i;
    for (int j = i + i; j <= MX + 100; j += i) {
      isp[j] = true;
    }
  }
  int T = 1;
  while (T--) solve();
}
