#include <bits/stdc++.h>
using namespace std;
void __print(int x) { cout << x; }
void __print(long x) { cout << x; }
void __print(long long x) { cout << x; }
void __print(unsigned x) { cout << x; }
void __print(unsigned long x) { cout << x; }
void __print(unsigned long long x) { cout << x; }
void __print(float x) { cout << x; }
void __print(double x) { cout << x; }
void __print(long double x) { cout << x; }
void __print(char x) { cout << '\'' << x << '\''; }
void __print(const char *x) { cout << '\"' << x << '\"'; }
void __print(const string &x) { cout << '\"' << x << '\"'; }
void __print(bool x) { cout << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  cout << '{';
  __print(x.first);
  cout << ',';
  __print(x.second);
  cout << '}';
}
template <typename T>
void __print(const T &x) {
  int f = 0;
  cout << '{';
  for (auto &i : x) cout << (f++ ? "," : ""), __print(i);
  cout << "}";
}
void _print() { cout << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cout << ", ";
  _print(v...);
}
const int N = 3e6 + 1;
bool prime[N];
int Div[N], num[N];
void sieve(int n) {
  vector<int> is_prime(n + 1, 1);
  for (int i = 2; i * i <= n; i++)
    if (is_prime[i])
      for (int j = i + i; j <= n; j += i) is_prime[j] = 0;
  int cnt = 1;
  for (int i = 2; i <= n; i++)
    if (is_prime[i]) prime[i] = 1, num[i] = cnt++;
}
void Divisors() {
  for (int i = 1; i < N; i++) {
    for (int j = i + i; j < N; j += i) {
      Div[j] = i;
    }
  }
}
void solve() {
  int n;
  cin >> n;
  vector<int> a(2 * n), ans;
  map<int, int> m;
  for (int i = 0; i <= 2 * n - 1; i++) cin >> a[i], m[a[i]]++;
  sort(a.rbegin(), a.rend());
  for (int i = 0; i <= 2 * n - 1; i++) {
    if (m[a[i]]) {
      int x = a[i];
      if (prime[x]) {
        int y = num[x];
        m[x]--, m[y]--;
        ans.push_back(y);
      } else {
        m[a[i]]--, m[Div[x]]--;
        ans.push_back(x);
      }
    }
  }
  for (auto i : ans) cout << i << ' ';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  sieve(N);
  Divisors();
  int T = 1;
  while (T--) solve();
  return 0;
}
