#include <bits/stdc++.h>
using namespace std;
long long power(long long a, long long b) {
  long long res = 1;
  a = a % 1000000000000;
  while (b > 0) {
    if (b & 1) {
      res = (res * a) % 1000000000000;
      b--;
    }
    a = (a * a) % 1000000000000;
    b >>= 1;
  }
  return res;
}
long long fermat_inv(long long y) { return power(y, 1000000000000 - 2); }
long long gcd(long long a, long long b) { return (b == 0) ? a : gcd(b, a % b); }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int N = 2750131;
  vector<int> lp(N + 1, 0);
  vector<long long> pr;
  for (int i = 2; i <= N; ++i) {
    if (lp[i] == 0) {
      lp[i] = i;
      pr.push_back(i);
    }
    for (long long j = 0;
         j < (int)pr.size() && pr[j] <= lp[i] && i * pr[j] <= N; ++j)
      lp[i * pr[j]] = pr[j];
  }
  long long t = 1;
  while (t--) {
    int n;
    cin >> n;
    multiset<int> s;
    int b[2 * n];
    for (int i = 0; i < 2 * n; i++) {
      cin >> b[i];
      s.insert(b[i]);
    }
    vector<int> ans;
    sort(b, b + 2 * n);
    for (int i = 2 * n - 1; i >= 0; i--) {
      if (lp[b[i]] != b[i] && b[i] <= 200000) {
        auto it = s.find(b[i]);
        if (it != s.end()) {
          int val = b[i] / lp[b[i]];
          auto it1 = s.find(val);
          if (it1 != s.end()) {
            s.erase(it);
            auto it2 = s.find(val);
            s.erase(it2);
            ans.push_back(b[i]);
          }
        }
      }
    }
    for (int i = 0; i < 2 * n; i++) {
      if (lp[b[i]] == b[i] && b[i] <= 200000) {
        auto it = s.find(b[i]);
        if (it != s.end()) {
          auto it1 = s.find(pr[b[i] - 1]);
          if (it1 != s.end()) {
            s.erase(it);
            auto it2 = s.find(pr[b[i] - 1]);
            s.erase(it2);
            ans.push_back(b[i]);
          }
        }
      }
    }
    for (int i = 0; i < ans.size(); i++) cout << ans[i] << " ";
  }
  return 0;
}
