#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const long long mod = (1e+9) + 7;
const long long sz = 2e5 + 9;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long power(long long a, long long b, long long m = mod) {
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = (res * a) % m;
    b = b >> 1;
    a = (a * a) % m;
  }
  return res;
}
const long long maxn = 2750133;
vector<long long> prime;
long long spf[maxn];
bool isp[maxn];
void seive() {
  for (long long i = 0; i < maxn; i++) isp[i] = true, spf[i] = i;
  isp[0] = isp[1] = false;
  for (long long i = 2; i * i < maxn; i++) {
    if (isp[i]) {
      for (long long j = i * i; j < maxn; j += i) {
        if (spf[j] == j) spf[j] = i;
        isp[j] = false;
      }
    }
  }
  for (long long i = 2; i < maxn; i++) {
    if (isp[i]) prime.push_back(i);
  }
}
long long get(long long x) { return x / spf[x]; }
void solve() {
  long long n;
  cin >> n;
  n = n * 2;
  long long a[n];
  map<long long, long long> m;
  for (long long i = 0; i < n; i++) cin >> a[i], m[a[i]]++;
  seive();
  vector<long long> v1;
  vector<long long> v2;
  sort(a, a + n);
  for (long long i = n - 1; i >= 0; i--) {
    if (isp[a[i]]) {
      if (m[a[i]] > 0) {
        v2.push_back(a[i]);
        m[a[i]]--;
      }
    } else {
      if (m[a[i]] > 0) {
        v1.push_back(a[i]);
        v1.push_back(get(a[i]));
        m[get(a[i])]--;
        m[a[i]]--;
      }
    }
  }
  sort(v1.begin(), v1.end(), greater<long long>());
  sort(v2.begin(), v2.end());
  map<long long, long long> m1;
  map<long long, long long> m2;
  for (long long i = 0; i < v1.size(); i++) m1[v1[i]]++;
  for (long long i = 0; i < v2.size(); i++) m2[v2[i]]++;
  vector<long long> ans;
  for (long long i = 0; i < v1.size(); i++) {
    if (m1[v1[i]] > 0) {
      long long gd = get(v1[i]);
      m1[gd]--;
      m1[v1[i]]--;
      ans.push_back(v1[i]);
    }
  }
  for (long long i = 0; i < v2.size(); i++) {
    if (m2[v2[i]] > 0) {
      long long pp = prime[v2[i] - 1];
      m2[pp]--;
      m2[v2[i]]--;
      ans.push_back(v2[i]);
    }
  }
  for (long long i = 0; i < ans.size(); i++) cout << ans[i] << " ";
  cout << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  clock_t beg = clock();
  solve();
  clock_t end = clock();
  fprintf(stderr, "%.3f sec, Copyright %c 2019 Skyscraper. \n",
          double(end - beg) / CLOCKS_PER_SEC, 184);
  return 0;
}
