#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<long long> spf(2750132, 0);
  vector<long long> prime;
  vector<bool> isprime(2750132, true);
  unordered_map<long long, long long> mp;
  long long i, j, c = 0;
  isprime[0] = isprime[1] = false;
  for (i = 2; i <= 2750131; i++) {
    if (isprime[i]) {
      prime.push_back(i);
      c++;
      mp[i] = c;
      spf[i] = i;
    }
    for (j = 0;
         j < prime.size() && prime[j] * i < 2750132 && prime[j] <= spf[i];
         j++) {
      isprime[i * prime[j]] = false;
      spf[i * prime[j]] = prime[j];
    }
  }
  long long n;
  cin >> n;
  long long k = 2 * n;
  vector<long long> a(k);
  unordered_map<long long, long long> m;
  for (i = 0; i < k; i++) {
    cin >> a[i];
    m[a[i]]++;
  }
  sort(a.begin(), a.end());
  vector<long long> ans;
  for (i = k - 1; i >= 0; i--) {
    if (m[a[i]] != 0) {
      if (isprime[a[i]] == true) {
        m[mp[a[i]]]--;
        m[a[i]]--;
        ans.push_back(mp[a[i]]);
      } else {
        long long h = spf[a[i]];
        long long g = a[i] / spf[a[i]];
        ans.push_back(a[i]);
        m[g]--;
        m[a[i]]--;
      }
    }
  }
  for (i = 0; i < ans.size(); i++) {
    cout << ans[i] << " ";
  }
  return 0;
}
