#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5, M = 2750131 + 10;
int a[N * 2], x[M];
bool p[M];
map<int, int> mp;
int maxDiv(int x) {
  for (int i = 2; i * i <= x; i++)
    if (x % i == 0) return x / i;
  return 1;
}
int main() {
  int z = 1;
  p[1] = true;
  for (int i = 2; i < M; i++) {
    if (!p[i]) {
      mp[z] = i;
      z++;
      for (int j = 2 * i; j < M; j += i) p[j] = true;
    }
  }
  int n;
  cin >> n;
  for (int i = 0; i < 2 * n; i++) {
    cin >> a[i];
    x[a[i]]++;
  }
  vector<int> ans;
  for (int i = M - 1; i >= 0; i--)
    if (x[i] && p[i]) {
      int y = maxDiv(i);
      x[y] -= x[i];
      for (int j = 0; j < x[i]; j++) ans.push_back(i);
      x[i] = 0;
    }
  for (int i = 1; i < M; i++)
    if (x[i] && !p[i]) {
      int y = mp[i];
      x[y] -= x[i];
      for (int j = 0; j < x[i]; j++) ans.push_back(i);
      x[i] = 0;
    }
  for (int i = 0; i < ans.size(); i++) cout << ans[i] << " ";
}
