#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 5;
const long long mo = 998244353;
long long sx, sy, ex, ey, dx[6] = {0, 1, 0, -1, 0, 0},
                          dy[6] = {1, 0, -1, 0, 0, 0}, m, n, k,
                          dz[6]{0, 0, 0, 0, -1, 1}, sg, re;
long long p, no, v, ans, w;
int par[55000];
long long a[400005], b[2750135], c[500006], d[400006];
struct mat {
  long long a[40][40];
};
long long gcd(long long a, long long b) { return a ? gcd(b % a, a) : b; }
set<long long> se;
long long qu(long long a, long long b, long long m) {
  long long ans = 1;
  while (b) {
    if (b & 1) {
      ans = ans % m * a % m;
    }
    b >>= 1;
    a = a % m * a % m;
  }
  return ans;
}
int su(int n) {
  if (n == 1 || n == 0) return 0;
  for (int i = 2; i <= sqrt(n); i++) {
    if (n % i == 0) return 0;
  }
  return 1;
}
int fi(int a) {
  if (a == par[a])
    return a;
  else
    return par[a] = fi(par[a]);
}
map<long long, long long> mp, mp1;
priority_queue<long long> que;
pair<long long, long long> a1[400000], a2[205];
int vis[2750131], vis1[2750131];
vector<long long> g[400000], g1[400000];
string s1;
struct node {
  long long x, y, t;
} aa[200005];
vector<long long> ve, ve1[3];
int cmp1(pair<long long, long long> a, pair<long long, long long> b) {
  return a.first > b.first;
}
int cmp(long long a, long long b) { return a > b; }
void su1(long long n) {
  int p = 1;
  for (int i = 2; i <= n; i++) b[i] = 1;
  for (int i = 2; i <= n; i++) {
    if (b[i]) {
      vis1[i] = p++;
      for (int j = 2 * i; j <= n; j += i) b[j] = 0;
    }
  }
}
int main() {
  int t, p2, p3;
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  string ss, sss, s;
  long long l, r, n1, u, d;
  su1(2750131);
  while (cin >> n) {
    for (int i = 0; i < 2 * n; i++) {
      cin >> a[i];
    }
    sort(a, a + 2 * n, cmp);
    for (int i = 0; i < 2 * n; i++) {
      vis[a[i]]--;
      if (vis[a[i]] < 0) {
        if (b[a[i]]) {
          vis[vis1[a[i]]]++;
          ve1[2].push_back(vis1[a[i]]);
        } else {
          for (long long j = 2; j <= sqrt(a[i]); j++) {
            if (a[i] % j == 0) {
              vis[a[i] / j]++;
              ve1[2].push_back(a[i]);
              break;
            }
          }
        }
      }
    }
    for (int i = 0; i < ve1[2].size(); i++) {
      cout << ve1[2][i] << " ";
    }
    cout << endl;
  }
}
