#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2750131 + 10;
int t;
int n, m;
bool vis[MAXN];
int prime[200010];
int cnt;
int num[MAXN];
void get_prime() {
  cnt = 1;
  memset(vis, false, sizeof(vis));
  vis[1] = 1, vis[0] = 1;
  for (int i = 2; i <= MAXN; i++) {
    if (!vis[i]) {
      prime[cnt++] = i;
      for (int j = 2 * i; j <= MAXN; j += i) vis[j] = 1;
    }
  }
}
int main() {
  std::ios::sync_with_stdio(false);
  get_prime();
  cin >> t;
  int Max = 0;
  for (int i = 0; i < 2 * t; i++) {
    cin >> n;
    num[n]++;
    Max = max(Max, n);
  }
  for (int i = Max; i >= 2; i--) {
    if (num[i] > 0 && vis[i]) {
      while (num[i] > 0) {
        int tmp = 0;
        cout << i << " ";
        for (int j = 2; j <= sqrt(i); j++) {
          if (i % j == 0) {
            tmp = i / j;
            break;
          }
        }
        num[i]--;
        num[tmp]--;
      }
    }
  }
  for (int i = 2; i <= Max; i++) {
    if (num[i] > 0) {
      while (num[i] > 0 && !vis[i]) {
        cout << i << ' ';
        num[i]--;
        num[prime[i]]--;
      }
    }
  }
  return 0;
}
