#include <bits/stdc++.h>
using namespace std;
int n;
multiset<int, greater<int>> s;
map<int, int> a;
map<int, int> e;
multiset<int> s_p;
bool is_prime[2750132];
int p[200000];
int d[200005];
void solve() {
  int cnt = 1;
  memset(is_prime, true, sizeof(is_prime));
  for (int i = 2; i <= 2750132; i++) {
    if (is_prime[i]) {
      p[cnt] = i;
      cnt++;
      for (int j = i * 2; j <= 2750132; j += i) {
        is_prime[j] = false;
        if (j <= 200000) d[j] = max(d[j], max(i, j / i));
      }
    }
  }
}
int main() {
  solve();
  s.clear();
  s_p.clear();
  cin >> n;
  int b;
  for (int i = 0; i < 2 * n; i++) {
    cin >> b;
    s.insert(b);
    if (a.find(b) == a.end())
      a[b] = 1;
    else
      a[b]++;
  }
  multiset<int, greater<int>>::iterator i1, i2;
  int k;
  for (i1 = s.begin(); i1 != s.end(); i1++) {
    k = (*i1);
    if (!is_prime[k] && (e.find(k) == e.end() || a[k] > e[k])) {
      cout << k << " ";
      if (e.find(k) == e.end())
        e[k] = 1;
      else
        e[k]++;
      if (e.find(d[k]) == e.end())
        e[d[k]] = 1;
      else
        e[d[k]]++;
    } else if (is_prime[k] && (e.find(k) == e.end() || a[k] > e[k])) {
      s_p.insert(k);
    }
  }
  for (i2 = s_p.begin(); i2 != s_p.end(); i2++) {
    k = (*i2);
    if (is_prime[k] && (e.find(k) == e.end() || a[k] > e[k])) {
      cout << k << " ";
      if (e.find(k) == e.end())
        e[k] = 1;
      else
        e[k]++;
      if (e.find(p[k]) == e.end())
        e[p[k]] = 1;
      else
        e[p[k]]++;
    }
  }
  return 0;
}
