#include <bits/stdc++.h>
using namespace std;
const int mod = (int)1e9 + 7;
const int nax = 3000000;
vector<int> prime(nax, 1), prime_pos;
void sieve() {
  prime[1] = 0;
  for (int i = 2; i < nax; i++) {
    if (prime[i]) {
      prime_pos.push_back(i);
      for (long long j = (long long)i * i; j < nax; j += i) prime[j] = 0;
    }
  }
}
void test_case() {
  sieve();
  int n;
  cin >> n;
  vector<int> arr(2 * n);
  for (int i = 0; i < 2 * n; i++) cin >> arr[i];
  multiset<int> v, pr;
  for (int i = 0; i < 2 * n; i++) {
    v.insert(arr[i]);
  }
  vector<int> ans;
  for (auto it = v.rbegin(); it != v.rend(); it++) {
    int val = *it;
    if (prime[val])
      pr.insert(val);
    else {
      ans.push_back(val);
      int fact;
      for (int i = 2; i * i <= val; i++) {
        if (val % i == 0) {
          fact = val / i;
          break;
        }
      }
      auto itt = v.find(fact);
      v.erase(itt);
    }
  }
  for (auto x : pr) {
    ans.push_back(x);
    int req = prime_pos[x - 1];
    auto it = pr.find(req);
    pr.erase(it);
  }
  for (auto x : ans) cout << x << " ";
}
int main() {
  int t = 1;
  while (t--) {
    test_case();
  }
}
