#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << "\n";
  err(++it, args...);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin.tie(NULL);
  long long int n, m, i, j, k, ans = 0;
  cin >> n;
  vector<long long int> b(2 * n);
  long long int N = 2750160;
  vector<long long int> prime(N + 1, -1), cnt(N + 1, 0), index(N + 1, -1),
      small(N + 1, -1);
  long long int id = 0;
  for (long long int p = 2; p <= N; p++) {
    if (prime[p] == -1) {
      for (i = p * 2; i <= N; i += p) {
        prime[i] = p;
        if (small[i] == -1) small[i] = p;
      }
      index[p] = id;
      id++;
    }
  }
  for (i = 0; i < n * 2; i++) {
    cin >> b[i];
    cnt[b[i]]++;
  }
  vector<long long int> a;
  sort(b.begin(), b.end());
  reverse(b.begin(), b.end());
  for (i = 0; i < n * 2; i++) {
    if (prime[b[i]] != -1 and cnt[b[i]] > 0) {
      cnt[(b[i] / small[b[i]])]--;
      a.push_back(b[i]);
      cnt[b[i]]--;
    }
  }
  vector<long long int> tem;
  for (i = N; i >= 2; i--) {
    if (cnt[i] > 0) {
      while (cnt[i]--) {
        cnt[index[i] + 1]--;
        a.push_back(index[i] + 1);
      }
    }
  }
  for (auto it : a) cout << it << " ";
  return 0;
}
