#include <bits/stdc++.h>
using namespace std;
const int64_t N = 2750141;
const int64_t INF = 1e18;
int64_t used[N];
vector<int64_t> prime;
multiset<int64_t> s;
vector<int64_t> ans;
int64_t n;
void f() {
  for (int64_t i = 2; i <= sqrt(N); i++)
    for (int64_t j = i * i; j < N; j += i)
      if (!used[j]) used[j] = j / i;
  for (int64_t i = 2; i < N; i++)
    if (!used[i]) prime.push_back(i);
}
int32_t main() {
  f();
  cin >> n;
  for (int64_t i = 0; i < 2 * n; i++) {
    int64_t x;
    cin >> x;
    s.insert(x);
  }
  auto it = s.end();
  --it;
  for (;; it--) {
    if (!used[*it]) {
      int64_t idx =
          (lower_bound(prime.begin(), prime.end(), *it) - prime.begin()) + 1;
      ans.push_back(idx);
      s.erase(s.find(idx));
    } else {
      ans.push_back(*it);
      s.erase(s.find(used[*it]));
    }
    if (it == s.begin()) break;
  }
  for (int64_t x : ans) {
    cout << x << " ";
  }
}
