#include <bits/stdc++.h>
using namespace std;
template <typename T>
string tos(T a) {
  stringstream ss;
  string ret;
  ss << a;
  ss >> ret;
  return ret;
}
void read(int &_a) { int temp = scanf("%d", &_a); }
void read(int &_a, int &_b) { int temp = scanf("%d %d", &_a, &_b); }
void read(int &_a, int &_b, int &_c) {
  int temp = scanf("%d %d %d", &_a, &_b, &_c);
}
const int SZ = 48000000;
char mark[SZ];
vector<int> PMS;
const int LM = 4e5 + 7;
int AR[LM];
vector<int> ANS;
int ST[SZ];
int main() {
  memset(mark, 0, sizeof mark);
  ;
  for (int i = 4; i < SZ; i += 2) mark[i] = 1;
  PMS.push_back(0);
  PMS.push_back(2);
  for (int i = 3; i < SZ; i += 2) {
    if (!mark[i]) {
      PMS.push_back(i);
      for (long long j = 1ll * i * i * 1ll; j < SZ; j += (1ll * i * 2ll))
        mark[j] = 1;
    }
  }
  int N;
  while (cin >> N) {
    int lm = 2 * N;
    ANS.clear();
    memset(ST, 0, sizeof ST);
    ;
    for (int(x) = (0); (x) < (lm); (x)++) {
      read(AR[x]);
      ST[AR[x]]++;
    }
    sort(AR, AR + lm);
    for (int x = lm - 1; x >= 0; x--) {
      if (ST[AR[x]] == 0) continue;
      if (binary_search(PMS.begin(), PMS.end(), AR[x]) == false) {
        int ind = 1;
        while (ind < PMS.size() && (AR[x] % PMS[ind]) != 0 && PMS[ind] < AR[x])
          ind++;
        if (ind < PMS.size()) {
          int d = AR[x] / PMS[ind];
          if (ST[d] > 0) {
            ANS.push_back(AR[x]);
            ST[AR[x]]--;
            ST[d]--;
          }
        }
      }
    }
    for (int x = lm - 1; x >= 0; x--) {
      if (ST[AR[x]] == 0) continue;
      if (binary_search(PMS.begin(), PMS.end(), AR[x])) {
        int d = PMS[AR[x]];
        if (ST[d] > 0) {
          ANS.push_back(AR[x]);
          ST[AR[x]]--;
          ST[d]--;
        }
      }
    }
    assert(ANS.size() == N);
    for (int(x) = (0); (x) < (N); (x)++) {
      if (x > 0) printf(" ");
      printf("%d", ANS[x]);
    }
    cout << endl;
  }
  return 0;
}
