#include <bits/stdc++.h>
using namespace std;
vector<long long int> v, primev;
int prime[2750150];
map<long long int, long long int> mp;
void FindPrime() {
  long long int n = 2750140;
  for (long long int i = 4; i <= n; i += 2) {
    prime[i] = true;
  }
  prime[1] = true;
  for (long long int i = 3; i * i <= n; i += 2) {
    if (!prime[i]) {
      for (long long int j = 2; i * j <= n; j++) {
        prime[i * j] = true;
      }
    }
  }
  primev.push_back(2);
  prime[2] = 2;
  int c = 3;
  for (long long int i = 3; i <= n; i = i + 2) {
    if (!prime[i]) {
      prime[i] = c;
      c++;
      primev.push_back(i);
    }
  }
}
long long int divisor(long long int a) {
  long long int chk = sqrt(a + 1);
  for (long long int i = 0; primev[i] <= chk; i++) {
    if (a % primev[i] == 0) {
      long long int res = a / primev[i];
      return res;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int a, b, c, d, e, i, j, test;
  FindPrime();
  cin >> a;
  for (i = 0; i < a * 2; i++) {
    cin >> b;
    mp[b]++;
    v.push_back(b);
  }
  sort(v.rbegin(), v.rend());
  for (i = 0; i < v.size(); i++) {
    if (mp[v[i]] > 0) {
      if (prime[v[i]] != 1) {
        long long int id = prime[v[i]];
        id--;
        cout << id << " ";
        mp[id]--;
        mp[v[i]]--;
      } else {
        long long int id = divisor(v[i]);
        cout << v[i] << " ";
        mp[id]--;
        mp[v[i]]--;
      }
    }
  }
  return 0;
}
