#include <bits/stdc++.h>
using namespace std;
int N, B[400005];
int md[2800000];
int id[2800000];
int Mai = 200000;
int Max = 2760000;
int To[400005], In[400005];
void build() {
  for (int i = 2; i <= Max; i++) md[i] = i;
  int now = 1;
  for (int i = 2; i <= Max; i++) {
    if (md[i] == i) {
      id[i] = now++;
      for (int j = i * 2; j <= Max; j += i) md[j] = min(md[j], i);
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  build();
  cin >> N;
  multiset<int> S;
  for (int i = 1; i <= 2 * N; i++) {
    cin >> B[i];
    S.insert(B[i]);
  }
  vector<int> ans;
  while (ans.size() < N) {
    auto it = prev(S.end());
    int Top = *it;
    S.erase(it);
    if (md[Top] == Top) {
      ans.push_back(id[Top]);
      S.erase(S.find(id[Top]));
    } else {
      ans.push_back(Top);
      S.erase(S.find(Top / md[Top]));
    }
  }
  for (int ai : ans) cout << ai << ' ';
  cout << '\n';
  return 0;
}
