#include <bits/stdc++.h>
using namespace std;
int prime[3000000];
map<int, int> mp;
void sieve() {
  for (int i = 2; i <= sqrt(2750131); i++) {
    for (int j = i * i; j <= 2750131; j += i) {
      prime[j] = max(prime[j], max(i, j / i));
    }
  }
  int curr = 199999;
  for (int i = 2750131; i >= 0; i--) {
    if (prime[i] == 0) {
      mp[i] = curr;
      curr--;
    }
  }
}
void solve() {
  sieve();
  int n;
  cin >> n;
  map<int, int> m;
  int a[2 * n + 1];
  a[0] = INT_MIN;
  for (int i = 1; i <= 2 * n; i++) {
    cin >> a[i];
    m[a[i]]++;
  }
  sort(a, a + 2 * n + 1);
  vector<int> ans;
  for (int i = 2 * n; i >= 1; i--) {
    if (m[a[i]] <= 0) continue;
    if (prime[a[i]] == 0) {
      ans.push_back(mp[a[i]]);
      m[a[i]]--;
      m[mp[a[i]]]--;
    } else {
      ans.push_back(a[i]);
      m[a[i]]--;
      m[prime[a[i]]]--;
    }
  }
  for (int i = 0; i < ans.size(); i++) cout << ans[i] << " ";
}
int main() {
  solve();
  return 0;
}
