#include <bits/stdc++.h>
using namespace std;
long long power(long long x, long long y);
long long mpower(long long x, long long y, long long p);
long long modInv(long long a, long long m);
long long gcdExtended(long long a, long long b, long long *x, long long *y);
bool isPrime(long long n);
long long X[2750132] = {0};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t, i, j, k, l, h, p, q, r, x, y, z, a, b, c, d, f, n, m,
      M = 1000000007;
  char ch, ch2, ch3;
  string s, s1, s2, s3;
  vector<long long> v, w;
  vector<long long>::iterator itrv;
  map<long long, long long> N;
  set<long long> S;
  multiset<long long> S1, S2;
  set<long long>::iterator itr;
  multiset<long long>::iterator it;
  for (i = 2; i < 2750132; i++) {
    if (X[i] == 0) {
      for (j = i + i; j < 2750132; j += i) {
        X[j] = 1;
      }
    }
  }
  for (i = 2; i < 2750132; i++) {
    if (X[i] == 0) {
      v.push_back(i);
      S.insert(i);
    }
  }
  cin >> n;
  n *= 2;
  long long A[n], B[n];
  for (i = 0; i < n; i++) {
    cin >> A[i];
    B[i] = 0;
  }
  sort(A, A + n);
  for (i = n - 1; i >= 0; i--) {
    it = S1.find(A[i]);
    if (it != S1.end()) {
      S1.erase(it);
      continue;
    }
    it = S2.find(A[i]);
    if (it != S2.end()) {
      S2.erase(it);
      B[i] = 1;
      continue;
    }
    if (S.find(A[i]) == S.end() || A[i] == 2) {
      B[i] = 1;
      p = sqrt(A[i]);
      for (j = 2; j <= p; j++) {
        if (A[i] % j == 0) {
          p = A[i] / j;
          S1.insert(p);
          break;
        }
      }
    } else {
      x = lower_bound(v.begin(), v.end(), A[i]) - v.begin();
      S2.insert(x + 1);
    }
  }
  for (i = 0; i < n; i++) {
    if (B[i]) {
      cout << A[i] << " ";
    }
  }
  return 0;
}
long long modInv(long long a, long long m) {
  long long x, y;
  long long g = gcdExtended(a, m, &x, &y);
  long long res = (x % m + m) % m;
  return res;
}
long long gcdExtended(long long a, long long b, long long *x, long long *y) {
  if (a == 0) {
    *x = 0, *y = 1;
    return b;
  }
  long long x1, y1;
  long long gcd = gcdExtended(b % a, a, &x1, &y1);
  *x = y1 - (b / a) * x1;
  *y = x1;
  return gcd;
}
long long mpower(long long x, long long y, long long p) {
  long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long power(long long x, long long y) {
  long long res = 1;
  while (y > 0) {
    if (y & 1) res = res * x;
    y = y >> 1;
    x = x * x;
  }
  return res;
}
bool isPrime(long long n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  long long p = sqrt(n);
  for (int i = 5; i <= p; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
