#include <bits/stdc++.h>
using namespace std;
vector<long long int> least_prime(2750132, 0);
vector<long long int> vv;
void leastPrimeFactor(int n) {
  least_prime[1] = 1;
  for (long long int i = 2; i <= n; i++) {
    if (least_prime[i] == 0) {
      least_prime[i] = i;
      vv.push_back(i);
      for (long long int j = 2 * i; j <= n; j += i)
        if (least_prime[j] == 0) {
          least_prime[j] = i;
        }
    }
  }
}
int main() {
  long long int n, i;
  cin >> n;
  long long int arr[2 * n + 1];
  long long int m = INT_MIN;
  map<long long int, long long int> mp;
  for (i = 0; i < 2 * n; i++) {
    cin >> arr[i];
    mp[arr[i]]++;
    m = max(m, arr[i]);
  }
  sort(arr, arr + 2 * n);
  leastPrimeFactor(m + 1);
  sort(vv.begin(), vv.end());
  vector<long long int> v;
  for (i = 2 * n - 1; i >= 0; i--) {
    if (mp[arr[i]] > 0) {
      if (arr[i] == least_prime[arr[i]] * least_prime[arr[i]]) {
        mp[least_prime[arr[i]]]--;
        cout << arr[i] << " ";
        mp[arr[i]]--;
      } else if (least_prime[arr[i]] != arr[i]) {
        cout << arr[i] << " ";
        mp[arr[i] / least_prime[arr[i]]]--;
        mp[arr[i]]--;
      } else if (least_prime[arr[i]] == arr[i]) {
        if (arr[i] > vv.size()) {
          continue;
        } else if (mp[vv[arr[i] - 1]] > 0) {
          cout << arr[i] << " ";
          mp[arr[i]]--;
          mp[vv[arr[i] - 1]]--;
        }
      }
    }
  }
  cout << "\n";
  return 0;
}
