#include <bits/stdc++.h>
using namespace std;
int h[2750132];
int spf[2750132];
vector<int> pr;
void sieve() {
  for (int i = 0; i < 2750132; i++) {
    spf[i] = i;
  }
  for (int i = 2; i < 2750132; ++i) {
    if (spf[i] != i) continue;
    for (long long j = 2 * i; j < 2750132; j += i) {
      if (spf[j] == j) spf[j] = i;
    }
  }
  for (int i = 2; i < 2750132; i++) {
    if (spf[i] == i) {
      pr.push_back(i);
    }
  }
  for (int i = 0; i < pr.size(); i++) {
    h[pr[i]] = i + 1;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  sieve();
  int n;
  cin >> n;
  multiset<int> s;
  for (int i = 0; i < 2 * n; i++) {
    int x;
    cin >> x;
    s.insert(-x);
  }
  for (int i = 0; i < n; i++) {
    int x = *s.begin();
    s.erase(s.begin());
    x = -x;
    if (spf[x] == x) {
      int y = h[x];
      if (s.lower_bound(-y) != s.end()) s.erase(s.lower_bound(-y));
      cout << y << " ";
    } else {
      int y = x / spf[x];
      if (s.lower_bound(-y) != s.end()) s.erase(s.lower_bound(-y));
      cout << x << " ";
    }
  }
}
