#include <bits/stdc++.h>
using namespace std;
const int N = 3e6 + 10;
int p[N], b[N];
bool vis[N];
const int M = 28e5;
int c[M];
int Oulashai(int n) {
  memset(vis, 0, sizeof(vis));
  int cnt = 1;
  for (int i = 2; i <= n; i++) {
    if (!vis[i]) p[cnt++] = i;
    for (int j = 1; j < cnt && i * p[j] <= n; j++) {
      vis[i * p[j]] = true;
      if (i % p[j] == 0) break;
    }
  }
  return cnt;
}
int findMax(int x) {
  for (int i = 2; i * i <= x; i++) {
    if (x % i == 0) return x / i;
  }
  return 0;
}
map<int, int> mp;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int al = Oulashai(N - 2);
  for (int i = 1; i <= al; i++) mp[p[i]] = i;
  int n;
  cin >> n;
  for (int i = 1; i <= 2 * n; i++) {
    cin >> b[i];
    c[b[i]]++;
  }
  sort(b + 1, b + 2 * n + 1);
  vector<int> v;
  for (int i = n * 2; i > 0; i--)
    if (!c[b[i]])
      continue;
    else if (!vis[b[i]]) {
      c[b[i]]--;
      v.push_back(mp[b[i]]);
      c[mp[b[i]]]--;
    } else {
      c[b[i]]--;
      int cur = findMax(b[i]);
      c[cur]--;
      v.push_back(b[i]);
    }
  for (int i = 0; i < v.size(); i++) cout << v[i] << " ";
  cout << endl;
  return 0;
}
