#include <bits/stdc++.h>
using namespace std;
template <typename T>
void chmin(T &a, T b) {
  if (a > b) a = b;
}
template <typename T>
void chmax(T &a, T b) {
  if (a < b) a = b;
}
int in() {
  int x;
  scanf("%d", &x);
  return x;
}
long long lin() {
  long long x;
  scanf("%lld", &x);
  return x;
}
vector<int> ps;
vector<int> primes(int n) {
  vector<bool> a(n + 1, 1);
  vector<int> p;
  for (int x = 2; x <= n; ++x) {
    if (!a[x]) continue;
    p.push_back(x);
    for (int y = 2 * x; y <= n; y += x) a[y] = 0;
  }
  return p;
}
int calc(int x) {
  for (int p = 2; p * p <= x; p++) {
    if (x % p == 0) return x / p;
  }
  if (x > ps.size()) return -1;
  return ps[x - 1];
}
int main() {
  int n;
  cin >> n;
  vector<int> a(2 * n);
  map<int, int> mp;
  for (int i = 0; i < 2 * n; ++i) {
    a[i] = in();
    mp[a[i]]++;
  }
  ps = primes(1e7);
  vector<int> b;
  map<int, int> b_inv;
  for (auto p : mp) {
    b.push_back(p.first);
    b_inv[p.first] = b.size() - 1;
  }
  int m = b.size();
  set<int> st;
  for (int i = 0; i < m; ++i) st.insert(i);
  vector<int> to(m, -1), from(m);
  for (int i = 0; i < m; ++i) {
    int x = calc(b[i]);
    if (b_inv.count(x)) {
      int y = b_inv[x];
      to[i] = y;
      from[y]++;
      st.erase(y);
    }
  }
  vector<int> ans;
  while (ans.size() < n && !st.empty()) {
    int x = *st.begin();
    st.erase(x);
    int y = to[x];
    if (y == -1) continue;
    int c = mp[b[x]];
    mp[b[x]] -= c;
    mp[b[y]] -= c;
    for (int i = 0; i < c; ++i) ans.push_back(b[x]);
    from[y]--;
    if (from[y] == 0) st.insert(y);
  }
  for (int i = 0; i < n; ++i) printf("%d ", ans[i]);
  cout << endl;
  return 0;
}
