#include <bits/stdc++.h>
using namespace std;
const int N = 2750132;
bool vis[N];
vector<int> v;
int cnt[N], dv[N];
int main() {
  for (int i = 2; i <= 2750131; i++) {
    if (vis[i]) continue;
    v.push_back(i);
    for (int j = i + i; j <= 2750131; j += i) {
      vis[j] = 1;
      if (!dv[j]) dv[j] = i;
    }
  }
  int n, x;
  cin >> n;
  vector<int> w(2 * n);
  for (int i = 0; i < 2 * n; i++) {
    cin >> w[i];
  }
  sort(w.begin(), w.end());
  vector<int> ans;
  for (int i = 2 * n - 1; i >= 0; i--) {
    if (cnt[w[i]]) {
      cnt[w[i]]--;
      continue;
    }
    assert(i > 0);
    if (!vis[w[i]]) {
      int x = lower_bound(v.begin(), v.end(), w[i]) - v.begin();
      x += 1;
      ans.push_back(x);
      cnt[x] += 1;
    } else {
      ans.push_back(w[i]);
      cnt[w[i] / dv[w[i]]] += 1;
    }
  }
  for (int x : ans) cout << x << " ";
  return 0;
}
