#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, inp;
  cin >> n;
  vector<int> arr;
  int upper = 2750132;
  vector<int> pnum;
  vector<int> ind(upper, 0);
  vector<bool> prime(upper, true);
  prime[0] = false;
  prime[1] = false;
  for (int i = 2; i < upper; i++) {
    if (prime[i]) {
      ind[i] = pnum.size() + 1;
      pnum.push_back(i);
      for (int j = 2 * i; j < upper; j += i) prime[j] = false;
    }
  }
  vector<int> count(upper, 0);
  for (int i = 0; i < 2 * n; i++) {
    cin >> inp;
    count[inp]++;
  }
  for (int i = 2e5 + 1; i < upper; i++) {
    if (count[i] > 0) {
      count[ind[i]] -= count[i];
      while (count[i]--) {
        arr.push_back(ind[i]);
      }
    }
  }
  for (int i = 2e5; i >= 2; i--) {
    if (count[i] == 0) continue;
    if (prime[i]) {
      while (count[i]--) {
        arr.push_back(ind[i]);
        count[ind[i]]--;
      }
    } else {
      int ele = -1;
      for (auto j : pnum) {
        if (i % j == 0) {
          ele = j;
          break;
        }
      }
      while (count[i]--) {
        arr.push_back(i);
        count[i / ele]--;
      }
    }
  }
  for (auto i : arr) cout << i << " ";
  cout << endl;
  return 0;
}
