#include <bits/stdc++.h>
using namespace std;
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
long long int power(long long int a, long long int b, long long int c) {
  long long int ans = 1;
  while (b) {
    if (b % 2) {
      ans = ((ans % c) * (a % c)) % c;
    }
    a = ((a % c) * (a % c)) % c;
    b = b / 2;
  }
  return ans;
}
long long int mod = 1e9 + 7;
int seive[2750132];
vector<int> prime;
int ans[2750132];
vector<int> pos[2750132];
vector<int> vans;
int main() {
  for (int i = 2; i <= 2750131; i++) {
    if (seive[i] == 0) {
      prime.push_back(i);
      for (int j = i * 2; j <= 2750131; j += i) {
        seive[j] = i;
      }
    }
  }
  int n;
  scanf("%d", &n);
  int b[2 * n];
  int visited[2 * n];
  memset(visited, 0, sizeof(visited));
  for (int j = 0; j < 2 * n; j++) {
    scanf("%d", &b[j]);
    if (seive[b[j]] != 0) {
      if (ans[b[j]] != 0) continue;
      for (long long int i = 2; i * i <= b[j] * 1LL; i++) {
        int x = i;
        if (b[j] % x == 0) {
          int ans1 = max(x, b[j] / x);
          ans[b[j]] = max(ans[b[j]], ans1);
        }
      }
    }
  }
  sort(b, b + 2 * n);
  for (int i = 0; i < 2 * n; i++) {
    pos[b[i]].push_back(i);
  }
  for (int i = 2 * n - 1; i >= 0; i--) {
    if (visited[i] == 0 && seive[b[i]] != 0) {
      vans.push_back(b[i]);
      int x = ans[b[i]];
      visited[pos[x].back()] = 1;
      pos[x].pop_back();
    }
  }
  for (int i = 0; i <= 2 * n - 1; i++) {
    if (visited[i] == 0 && seive[b[i]] == 0) {
      vans.push_back(b[i]);
      int x = b[i];
      int y = prime[x - 1];
      visited[pos[y].back()] = 1;
      pos[y].pop_back();
    }
  }
  for (int i : vans) printf("%d ", i);
  printf("\n");
  return 0;
}
