#include <bits/stdc++.h>
using namespace std;
long long spf[3000005];
void seive() {
  spf[1] = 1;
  for (long long i = 2; i < 3000005; i++) spf[i] = i;
  for (long long i = 4; i < 3000005; i += 2) spf[i] = 2;
  for (long long i = 3; i * i < 3000005; i++) {
    if (spf[i] == i) {
      for (long long j = i * i; j < 3000005; j += i)
        if (spf[j] == j) spf[j] = i;
    }
  }
}
vector<long long> getFactorization(long long x) {
  vector<long long> ret;
  while (x != 1) {
    ret.push_back(spf[x]);
    long long p = spf[x];
    while (x % p == 0) x = x / p;
  }
  return ret;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int TESTS = 1;
  while (TESTS--) {
    seive();
    multiset<long long> pr;
    multiset<long long, greater<long long>> nonpr;
    long long n;
    cin >> n;
    vector<long long> prime;
    prime.push_back(1);
    for (long long i = 2; i < 3000005; i++) {
      if (spf[i] == i) prime.push_back(i);
    }
    for (long long i = 0; i < 2 * n; i++) {
      long long x;
      cin >> x;
      if (spf[x] == x) {
        pr.insert(x);
      } else {
        nonpr.insert(x);
      }
    }
    for (auto i : nonpr) {
      if (spf[i / spf[i]] == i / spf[i])
        pr.erase(pr.lower_bound(i / spf[i]));
      else
        nonpr.erase(nonpr.lower_bound(i / spf[i]));
    }
    for (auto i : pr) {
      pr.erase(pr.lower_bound(prime[i]));
    }
    for (auto i : pr) cout << i << ' ';
    for (auto i : nonpr) cout << i << ' ';
  }
  return 0;
}
