#include <bits/stdc++.h>
using namespace std;
const int nMAX = 3750131;
int n, a[nMAX], id[nMAX];
bool vis[nMAX];
int phi(int x) {
  for (int i = 2; i * i <= x; ++i)
    if (x % i == 0) return x / i;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  vector<int> p;
  for (int i = 2; i < nMAX; ++i) {
    if (vis[i]) continue;
    p.push_back(i);
    id[i] = p.size();
    for (int j = i * 2; j < nMAX; j += i) vis[j] = 1;
  }
  cin >> n;
  n *= 2;
  for (int i = 1; i <= n; ++i) {
    int x;
    cin >> x;
    a[x] += 1;
  }
  vector<int> res;
  for (int i = nMAX - 1; i >= 2; i--) {
    while (a[i]) {
      if (!vis[i]) {
        res.push_back(id[i]);
        a[id[i]]--;
      } else {
        res.push_back(i);
        a[phi(i)]--;
      }
      a[i]--;
    }
  }
  for (auto x : res) cout << x << " ";
}
