#include <bits/stdc++.h>
using namespace std;
const int mxprime = 2750131;
int prime[mxprime + 1], res;
int func(int n) {
  for (int i = 2; i * i <= n; i++)
    if (n % i == 0) return n / i;
}
vector<int> ord(mxprime, false);
int vc[500001];
int main() {
  int n;
  cin >> n;
  prime[1] = true;
  map<int, int> mp;
  for (int i = 2; i * i <= mxprime; i++) {
    if (!prime[i]) {
      for (int j = i * i; j <= mxprime; j += i) {
        prime[j] = true;
      }
    }
  }
  for (int i = 2; i <= mxprime; i++) {
    if (!prime[i]) {
      ord[i] = ++res;
    }
  }
  vector<int> a;
  n = n * 2;
  for (int i = 1; i <= n; i++) {
    cin >> vc[i];
    mp[vc[i]]++;
  }
  sort(vc + 1, vc + n + 1, greater<int>());
  for (int i = 1; i <= n; i++) {
    if (!mp[vc[i]]) continue;
    if (!prime[vc[i]]) {
      a.push_back(ord[vc[i]]);
      mp[ord[vc[i]]]--;
    } else {
      a.push_back(vc[i]);
      mp[func(vc[i])]--;
    }
    mp[vc[i]]--;
  }
  for (int i = 0; i < a.size(); i++) {
    cout << a[i] << " ";
  }
}
