#include <bits/stdc++.h>
using namespace std;
long long int const num = 2750132;
long long int prim[num];
long long int ord[num];
long long int occur[num];
void solve() {
  prim[0] = 1;
  prim[1] = 1;
  int ind = 1;
  for (long long int i = 2; i < num; i++) {
    if (prim[i] == 0) {
      ord[i] = ind;
      ind++;
      for (long long int j = i * i; j < num; j += i) {
        if (prim[j] == 0) {
          prim[j] = 1;
          ord[j] = i;
        }
      }
    }
  }
  long long int n;
  cin >> n;
  long long int x;
  vector<long long int> prime;
  vector<long long int> comp;
  vector<long long int> ans;
  for (int i = 0; i < 2 * n; i++) {
    cin >> x;
    occur[x]++;
    if (prim[x] == 0) {
      prime.push_back(x);
    } else
      comp.push_back(x);
  }
  sort(prime.begin(), prime.end());
  sort(comp.begin(), comp.end());
  for (int i = comp.size() - 1; i >= 0; i--) {
    if (occur[comp[i]] > 0) {
      occur[comp[i]]--;
      ans.push_back(comp[i]);
      occur[comp[i] / ord[comp[i]]]--;
    }
  }
  for (int i = prime.size() - 1; i >= 0; i--) {
    if (occur[prime[i]] > 0) {
      occur[prime[i]]--;
      ans.push_back(ord[prime[i]]);
      occur[ord[prime[i]]]--;
    }
  }
  for (int i = 0; i < n; i++) cout << ans[i] << " ";
}
int main() {
  int t;
  t = 1;
  while (t--) {
    solve();
  }
  return (0);
}
