#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2750133;
int sieve[MAXN];
map<int, int> primes;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  int p = 1;
  memset(sieve, -1, sizeof sieve);
  for (int i = 2; i < MAXN; i++) {
    if (sieve[i] == -1) {
      primes[i] = p++;
      sieve[i] = i;
    }
    for (int j = i * 2; j < MAXN; j += i) {
      sieve[j] = i;
    }
  }
  multiset<int> a;
  for (int i = 0; i < 2 * n; i++) {
    int x;
    cin >> x;
    a.insert(x);
  }
  vector<int> ans;
  while (a.size()) {
    int mv = *prev(a.end());
    if (sieve[mv] == mv && sieve[sieve[mv]] == sieve[mv]) {
      ans.push_back(primes[mv]);
      a.erase(a.find(primes[mv]));
      a.erase(a.find(mv));
    } else {
      ans.push_back(mv);
      a.erase(a.find(sieve[mv]));
      a.erase(a.find(mv));
    }
  }
  for (auto x : ans) {
    cout << x << " ";
  }
  cout << "\n";
  return 0;
}
