#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
#pragma GCC optimize("fast-math")
using namespace std;
const long long INF = 1e18 + 7;
const long double EPS = 0.1;
long long a[410000];
unordered_map<long long, long long> kol, pos;
unordered_map<long long, bool> u;
vector<long long> v, ans;
inline bool prost(long long n) {
  bool z = true;
  for (long long j = 2; j * j <= n; j++) {
    if (n % j == 0) {
      z = false;
      break;
    }
  }
  return z;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long n;
  cin >> n;
  n *= 2;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    kol[a[i]]++;
  }
  sort(a, a + n);
  reverse(a, a + n);
  for (long long i = 2; i <= a[0]; i++) {
    if (prost(i)) {
      v.emplace_back(i);
      pos[i] = v.size() - 1;
    }
  }
  for (long long i = 0; i < n; i++) {
    if (!u[a[i]]) {
      bool z = true;
      z = prost(a[i]);
      if (z) {
        long long x = pos[a[i]];
        x++;
        kol[x]--;
        ans.emplace_back(x);
        if (kol[x] == 0) u[x] = true;
      } else {
        long long maxx = 0;
        for (long long j = 2; j * j <= a[i]; j++) {
          if (a[i] % j == 0) {
            z = false;
            maxx = max(maxx, j);
            maxx = max(maxx, a[i] / j);
            break;
          }
        }
        long long x = maxx;
        kol[x]--;
        if (kol[x] == 0) u[x] = true;
        ans.emplace_back(a[i]);
      }
      kol[a[i]]--;
      if (kol[a[i]] == 0) u[a[i]] = true;
    }
  }
  for (auto i : ans) cout << i << ' ';
  return 0;
}
