#include <bits/stdc++.h>
using namespace std;
vector<long long> prime(2750132, 0);
vector<long long> prr;
void pri(void) {
  long long i, j, k, l, p, n;
  for (i = 2; i <= 2750131; i++) {
    if (prime[i] == 0) {
      p = 2;
      n = p * i;
      while (n <= 2750131) {
        prime[n] = 1;
        p++;
        n = p * i;
      }
      prr.push_back(i);
    }
  }
}
bool isprime(long long n) {
  long long i, j;
  for (i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      return 0;
    }
  }
  return 1;
}
int main() {
  long long n, i, j, k, l, ans, a, b;
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  map<long long, long long, greater<long long> > sp;
  for (i = 0; i < (2 * n); i++) {
    cin >> l;
    sp[l]++;
  }
  vector<long long> apple;
  pri();
  vector<pair<long long, long long> > brr;
  for (auto it = sp.begin(); it != sp.end(); it++) {
    a = (*it).first;
    b = (*it).second;
    if (!isprime(a) && b > 0) {
      for (i = 2; i * i <= a; i++) {
        if (a % i == 0) {
          ans = a / i;
          sp[ans] -= b;
          sp[a] = 0;
          brr.push_back(make_pair(a, b));
          break;
        }
      }
    }
  }
  auto it = sp.end();
  it--;
  for (;; it--) {
    a = (*it).first;
    b = (*it).second;
    if (it == sp.begin()) {
      if (b > 0) {
        ans = prr[a - 1];
        sp[ans] -= b;
        sp[a] = 0;
        brr.push_back(make_pair(a, b));
      }
      break;
    }
    if (b > 0) {
      ans = prr[a - 1];
      sp[ans] -= b;
      sp[a] = 0;
      brr.push_back(make_pair(a, b));
    }
  }
  for (i = 0; i < brr.size(); i++) {
    a = brr[i].first;
    b = brr[i].second;
    while (b > 0) {
      cout << a << " ";
      b--;
    }
  }
  cout << endl;
  return 0;
}
