#include <bits/stdc++.h>
using namespace std;
map<long long int, long long int> mp;
bool mark[3000006];
vector<long long int> prime, v1;
void sieve(long long int x) {
  long long int i, j;
  mark[1] = 1;
  for (long long int i = 4; i <= x; i = i + 2) mark[i] = 1;
  for (i = 3; i * i <= x; i += 2)
    if (!mark[i])
      for (j = i * i; j <= x; j += 2 * i) mark[j] = 1;
  prime.push_back(2);
  for (i = 3; i <= x; i += 2)
    if (mark[i] == 0) prime.push_back(i);
}
long long int largeDiv(long long int x) {
  for (int i = 0; i < prime.size(); i++)
    if (x % prime[i] == 0) return x / prime[i];
}
int main() {
  sieve(3000000);
  long long int a, b, i;
  cin >> a;
  for (i = 0; i < a + a; i++) {
    scanf("%lld", &b);
    mp[b]++;
    v1.push_back(b);
  }
  sort(v1.rbegin(), v1.rend());
  for (i = 0; i < a + a; i++) {
    if (mp[v1[i]] && mark[v1[i]]) {
      long long int x = largeDiv(v1[i]);
      if (mp[x]) {
        mp[x]--;
        mp[v1[i]]--;
        printf("%lld ", v1[i]);
      }
    }
  }
  reverse(v1.begin(), v1.end());
  for (i = 0; i < a + a; i++) {
    if (mp[v1[i]]) {
      if (mp[prime[v1[i] - 1]]) {
        mp[prime[v1[i] - 1]]--;
        mp[v1[i]]--;
        printf("%lld ", v1[i]);
      }
    }
  }
  return 0;
}
