#include <bits/stdc++.h>
using namespace std;
inline void fastio() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
const long long N = 2750131;
long long lp[N + 1];
vector<long long> pr;
map<long long, long long> bp;
void solve() {
  for (long long i = 2; i <= N; ++i) {
    if (lp[i] == 0) {
      lp[i] = i;
      pr.push_back(i);
    }
    for (long long j = 0;
         j < (long long)pr.size() && pr[j] <= lp[i] && i * pr[j] <= N; ++j)
      lp[i * pr[j]] = pr[j];
  }
  for (long long i = 0; i < pr.size(); ++i) {
    bp[pr[i]] = i + 1;
  }
  long long n;
  cin >> n;
  multiset<long long> ms;
  for (long long i = 0; i < 2 * n; ++i) {
    long long x;
    cin >> x;
    ms.insert(-x);
  }
  while (!ms.empty()) {
    auto bg = ms.begin();
    long long num = -(*bg);
    if (lp[num] == num) {
      long long num2 = bp[num];
      ms.erase(bg);
      ms.erase(ms.find(-num2));
      cout << num2 << ' ';
    } else {
      ms.erase(ms.find(-(num / lp[num])));
      ms.erase(bg);
      cout << num << ' ';
    }
  }
  cout << '\n';
}
signed main() {
  fastio();
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
