#include <bits/stdc++.h>
using namespace std;
const int MAXP = 2750159 + 123, MAXN = 200 * 1000 + 123;
bool mark[MAXP];
int nat[MAXP];
int n, m, a;
multiset<int> s;
vector<int> v;
void gh() {
  int cnt = 0;
  mark[0] = mark[1] = 1;
  for (int i = 2; i < MAXP; i++)
    if (!mark[i]) {
      nat[i] = ++cnt;
      for (int j = (i << 1); j < MAXP; j += i) mark[j] = 1;
    }
}
void cal() {
  for (int i = 2; i < MAXN; i++)
    if (mark[i]) {
      int j = 2;
      for (; j * j <= i; j++)
        if (i % j == 0) {
          nat[i] = i / j;
          break;
        }
    }
}
int main() {
  gh();
  cal();
  cin >> n;
  for (int i = 0; i < (n << 1); i++) {
    cin >> a;
    s.insert(a);
  }
  while (!s.empty()) {
    int x = *(--s.end());
    s.erase(s.find(nat[x])), s.erase(s.find(x));
    if (!mark[x])
      v.push_back(nat[x]);
    else
      v.push_back(x);
  }
  for (int i : v) cout << i << ' ';
  return 0;
}
