#include <bits/stdc++.h>
using namespace std;
long long f[2750137];
long long prime[200007], k = 1;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  prime[k++] = 2;
  for (int i = 4; i < 2750132; i += 2) f[i] = i / 2;
  f[0] = f[1] = 1;
  for (int i = 3; i < 2750132; i += 2) {
    if (!f[i]) {
      prime[k++] = i;
      for (int j = i + i; j < 2750132; j += i) {
        if (!f[j]) {
          f[j] = max(i, j / i);
        }
      }
    }
  }
  long long n;
  cin >> n;
  long long arr[2 * n], u;
  map<long long, long long> mp;
  for (int i = 0; i < 2 * n; i++) {
    cin >> arr[i];
    mp[arr[i]]++;
  }
  vector<long long> ans;
  sort(arr, arr + (2 * n));
  for (int i = 2 * n - 1; i >= 0; i--) {
    u = arr[i];
    if (f[u] == 0 && mp[u]) {
      if (u < 200000 && mp[prime[u]]) {
        mp[prime[u]]--;
        mp[u]--;
        ans.push_back(u);
      }
    } else if (mp[u]) {
      if (mp[f[u]]) {
        mp[f[u]]--;
        mp[u]--;
        ans.push_back(u);
      }
    }
  }
  for (int i = 0; i < ans.size(); i++) cout << ans[i] << " ";
  cout << "\n";
  return 0;
}
