#include <bits/stdc++.h>
using namespace std;
int table[2750135];
int sushu[2750135];
int dele[2750135];
void makeTable() {
  table[1] = 0;
  int j, i;
  int cnt = (int)sqrt((double)2750135);
  for (i = 2; i < cnt; i++) {
    if (table[i] != 0) continue;
    for (j = i * i; j < 2750135; j += i) {
      if (table[j] != 0) continue;
      table[j] = i;
    }
  }
  j = 1;
  for (i = 2; i < 2750135; i++) {
    if (table[i] == 0) {
      sushu[i] = j;
      j++;
    }
  }
}
int main() {
  int n;
  cin >> n;
  int index = 0, i;
  for (i = 0; i < 2 * n; i++) {
    int temp;
    cin >> temp;
    dele[temp]++;
  }
  makeTable();
  for (i = 2750131; i >= 0; i--) {
    if (dele[i] == 0) continue;
    if (table[i] == 0) {
      cout << sushu[i] << " ";
      dele[sushu[i]]--;
      dele[i]--;
      i++;
    } else {
      int temp = i / table[i];
      dele[temp]--;
      cout << i << " ";
      dele[i]--;
      i++;
    }
  }
}
