#include <bits/stdc++.h>
using namespace std;
const int mx = 2750132;
bool arr[mx];
map<int, int> mp;
void Sieve() {
  memset(arr, true, sizeof(arr));
  int sq = sqrt(mx);
  for (int p = 2; p <= sq; p++) {
    if (arr[p] == true) {
      for (int i = p * p; i <= mx; i += p) arr[i] = false;
    }
  }
  int j = 1;
  for (int i = 2; i < mx; i++) {
    if (arr[i]) {
      mp[i] = j++;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  Sieve();
  int n;
  cin >> n;
  vector<int> v(2 * n);
  for (int i = 0; i < 2 * n; i++) {
    cin >> v[i];
  }
  sort(v.begin(), v.end());
  bool index[2 * n];
  memset(index, true, sizeof index);
  map<int, int> m;
  for (int i = 2 * n - 1; i >= 0; i--) m[v[i]] = i;
  for (int i = 2 * n - 1; i >= 0; i--) {
    if (index[i]) {
      if (arr[v[i]]) {
        int el = mp[v[i]];
        int id = lower_bound(v.begin(), v.end(), el) - v.begin();
        cout << v[id] << " ";
        index[m[v[id]]] = false;
        m[v[id]]++;
      } else {
        cout << v[i] << " ";
        int sq = sqrt(v[i]), ind = -1;
        for (int j = 2; j <= sq; j++) {
          if (v[i] % j == 0) {
            int x = v[i] / j;
            ind = lower_bound(v.begin(), v.end(), x) - v.begin();
            if (v[ind] == x) {
              break;
            }
          }
        }
        index[m[v[ind]]] = false;
        m[v[ind]]++;
      }
    }
  }
}
