#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int mod2 = 1e9 + 13;
const int MAXN = 2750132;
int p[MAXN], used[MAXN];
multiset<int> s;
void erat() {
  for (int i = 0; i < MAXN; ++i) used[i] = 1;
  used[0] = used[1] = 0;
  for (int i = 2; i < MAXN; ++i) {
    if (used[i]) {
      for (int j = 2 * i; j < MAXN; j += i) used[j] = 0;
    }
  }
  int ct = 2;
  for (int i = 3; i < MAXN; ++i) {
    if (used[i]) {
      p[i] = ct;
      ++ct;
    }
  }
}
int mxdel(int x) {
  int vitochka = 1;
  for (int i = sqrt(x); i > 1; --i) {
    if (x % i == 0) vitochka = max(vitochka, max(i, x / i));
  }
  return vitochka;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  erat();
  int n;
  cin >> n;
  for (int i = 0; i < 2 * n; ++i) {
    int x;
    cin >> x;
    s.emplace(x);
  }
  vector<int> rs;
  while (!s.empty()) {
    auto it = --s.end();
    if (p[*it]) {
      rs.emplace_back(p[*it]);
      s.erase(s.find(p[*it]));
    } else {
      rs.emplace_back(*it);
      s.erase(s.find(mxdel(*it)));
    }
    s.erase(--s.end());
  }
  for (auto el : rs) cout << el << " ";
  return 0;
}
