#include <bits/stdc++.h>
using namespace std;
vector<long long> v;
bool isPrime(int n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (int i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
void printPrime(int n) {
  for (int i = 2; i <= n; i++) {
    if (isPrime(i)) {
      v.push_back(i);
    }
  }
}
long long prime(long long n) {
  long long ma = 1;
  for (long long i = 2; i <= sqrt(n); i++) {
    if (n % i == 0) {
      if (i == n / i) {
        if (i > ma) ma = i;
      } else {
        if (i > ma) ma = i;
        if (n / i > ma) ma = n / i;
      }
    }
  }
  return ma;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n;
  cin >> n;
  long long ar[200005];
  memset(ar, 0, sizeof(ar));
  for (long long i = 0; i < 2 * n; i++) {
    long long a;
    cin >> a;
    if (a <= 200000) ar[a]++;
  }
  printPrime(2750131);
  vector<long long> v1, v2;
  for (long long i = 200000; i >= 2; i--) {
    if (ar[i] > 0) {
      long long a = prime(i);
      if (a != 1) {
        long long p = ar[i];
        for (long long j = 0; j < p; j++) {
          v1.push_back(i);
          ar[a]--;
          ar[i]--;
        }
      } else {
        for (long long j = 0; j < ar[i]; j++) {
          v2.push_back(i);
        }
      }
    }
  }
  if (v2.size() != 0) {
    long long a = v2.size();
    for (long long i = a - 1; i >= 0; i--) {
      if (ar[v2[i]] > 0) {
        if (v2[i] > 199999) {
          v1.push_back(v2[i]);
        } else {
          v1.push_back(v2[i]);
          ar[v2[i]]--;
          if (v[v2[i] - 1] <= 200000) ar[v[v2[i] - 1]]--;
        }
      }
    }
  }
  for (long long i = 0; i < n; i++) cout << v1[i] << " ";
}
