#include <bits/stdc++.h>
using namespace std;
void boost() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
const int N = 3000000;
bool prime[N];
int num[N] = {0};
void sieve() {
  int i;
  for (i = 2; i < N; i++) {
    prime[i] = true;
    num[i] = INT_MAX;
  }
  for (i = 2; i < N; i++) {
    if (!prime[i]) continue;
    for (int j = 2 * i; j < N; j += i) {
      prime[j] = false;
      num[j] = min(num[j], i);
    }
  }
  int co = 1;
  for (i = 2; i < N; i++) {
    if (prime[i]) {
      num[i] = co;
      co++;
    } else {
      num[i] = i / num[i];
    }
  }
}
int fr[N] = {0};
int main() {
  int n, i;
  cin >> n;
  vector<int> v;
  for (i = 0; i < 2 * n; i++) {
    int x;
    cin >> x;
    fr[x]++;
  }
  sieve();
  vector<int> ans;
  for (i = N - 1; i >= 2; i--) {
    while (fr[i]--) {
      if (prime[i])
        ans.push_back(num[i]);
      else
        ans.push_back(i);
      fr[num[i]]--;
    }
  }
  for (i = 0; i < ans.size(); i++) cout << ans[i] << " ";
}
