#include <bits/stdc++.h>
using namespace std;
int su[3000000];
vector<int> vec;
int vv[3000010];
int main() {
  memset(su, 0, sizeof(su));
  memset(vv, 0, sizeof(vv));
  vec.push_back(2);
  for (int i = 3; i <= 2750131; i++) {
    for (int j = 0; j < vec.size(); j++) {
      if (vec[j] * vec[j] > i) break;
      if (i % vec[j] == 0) {
        su[i] = i / vec[j];
        break;
      }
    }
    if (su[i] == 0) vec.push_back(i);
  }
  int n;
  scanf("%d", &n);
  int h_sum = 2 * n;
  for (int i = 1; i <= 2 * n; i++) {
    int x;
    scanf("%d", &x);
    vv[x]++;
  }
  for (int i = 2750131; i >= 2; i--) {
    while (su[i] && vv[i]) {
      printf("%d ", i);
      vv[i]--;
      vv[su[i]]--;
      h_sum -= 2;
    }
  }
  for (int i = 2750131; i >= 2; i--) {
    if (h_sum == 0) break;
    while (vv[i]) {
      int k = lower_bound(vec.begin(), vec.end(), i) - vec.begin() + 1;
      printf("%d ", k);
      vv[i]--;
      vv[k]--;
      h_sum -= 2;
      if (h_sum == 0) break;
    }
  }
  printf("\n");
  return 0;
}
