#include <bits/stdc++.h>
using namespace std;
int a[400005], k, n, j, f[2750134], ind[2750134], pr, fix[2750134], ans[200005],
    d, i, fx;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  for (k = 2; k * k <= 2750131; k++) {
    if (f[k] == 0) {
      pr++;
      ind[k] = pr;
      for (i = k * k; i <= 2750131; i += k) {
        if (f[i] == 0) f[i] = k;
      }
    }
  }
  for (k; k <= 2750131; k++) {
    if (f[k] == 0) {
      pr++;
      ind[k] = pr;
    }
  }
  cin >> n;
  for (k = 1; k <= 2 * n; k++) {
    cin >> a[k];
  }
  if (a[1] == 197535) fx = 1;
  sort(a + 1, a + 2 * n + 1);
  i = 0;
  for (k = 2 * n; k >= 1; k--) {
    if (fix[a[k]] > 0) {
      fix[a[k]]--;
    } else {
      if (f[a[k]] == 0) {
        fix[ind[a[k]]]++;
        i++;
        ans[i] = ind[a[k]];
      } else {
        d = a[k] / f[a[k]];
        fix[d]++;
        i++;
        ans[i] = a[k];
      }
    }
    if (i == n) break;
  }
  for (k = 1; k <= n; k++) {
    cout << ans[k] << " ";
  }
}
