#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  const int N = 3e6;
  vector<int> prime(N + 1, 1);
  map<int, int> rel;
  int cnt = 1;
  for (int i = 2; i <= N; i++) {
    if (prime[i] == 1) {
      rel[i] = cnt++;
      for (int j = 2; i * j <= N; j++) {
        if (prime[i * j] == 1) prime[i * j] = i;
      }
    }
  }
  int n;
  cin >> n;
  vector<int> store(2 * n + 1);
  vector<int> visited(2 * n + 1);
  map<int, vector<int> > pos;
  for (int i = 1; i <= 2 * n; i++) {
    cin >> store[i];
  }
  sort(store.begin(), store.end());
  for (int i = 1; i <= 2 * n; i++) {
    pos[store[i]].push_back(i);
  }
  vector<int> ans;
  for (int i = 2 * n; i >= 1; i--) {
    if (visited[i]) continue;
    if (prime[store[i]] == 1) {
      int var = rel[store[i]];
      int address = pos[var].back();
      visited[address] = 1;
      pos[var].pop_back();
      ans.push_back(var);
    } else {
      int num = store[i] / prime[store[i]];
      int address = pos[num].back();
      visited[address] = 1;
      pos[num].pop_back();
      ans.push_back(store[i]);
    }
  }
  for (int nums : ans) cout << nums << " ";
  return 0;
}
