#include <bits/stdc++.h>
using namespace std;
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  cerr << '{';
  __print(x.first);
  cerr << ',';
  __print(x.second);
  cerr << '}';
}
template <typename T>
void __print(const T &x) {
  int f = 0;
  cerr << '{';
  for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
  cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cerr << ", ";
  _print(v...);
}
struct custom_hash {
  static uint64_t splitmix64(uint64_t x) {
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM =
        chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};
template <typename T>
ostream &operator<<(ostream &output, const vector<T> &v) {
  if (v.empty()) return output;
  for (int i = 0; i < v.size() - 1; i++) output << v[i] << " ";
  output << v.back();
  return output;
}
template <typename T>
istream &operator>>(istream &input, vector<T> &v) {
  for (auto &i : v) cin >> i;
  return input;
}
int power(long long x, long long n, const long long P) {
  if (x == 0) return 0;
  if (n == 0 || x == 1) return 1LL;
  x %= P;
  int res = 1;
  while (n > 0) {
    if (n & 1) res = (long long int)res * x % P;
    x = (long long int)x * x % P;
    n /= 2;
  }
  return res;
}
long long int power(long long int x, long long int n) {
  if (x == 0)
    return 0;
  else if (n == 0 || x == 1)
    return 1;
  long long res = 1;
  while (n > 0) {
    if (n & 1) res *= x;
    x *= x;
    n /= 2;
  }
  return res;
}
int inv(long long x) { return power(x, 1000000007 - 2, 1000000007); }
long long int gcd(const long long int a, const long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long int lcm(const long long int a, const long long int b) {
  return (a * b) / gcd(a, b);
}
pair<int, int> dx[4] = {make_pair(-1, 0), make_pair(1, 0), make_pair(0, -1),
                        make_pair(0, 1)};
int spf[20000010];
int prime[20000100];
void pre_prime() {
  for (int i = 0; i < 20000010; i++) spf[i] = i;
  int cnt = 0;
  for (int i = 2; i <= 20000000; i++) {
    if (spf[i] == i) {
      cnt++;
      prime[i] = cnt;
      for (int j = 2; j * i <= 20000000; j++) {
        if (spf[j * i] == j * i) spf[i * j] = i;
      }
    }
  }
}
void __sol() {
  int n;
  cin >> n;
  vector<int> b(2 * n);
  cin >> b;
  multiset<int, greater<int>> s(b.begin(), b.end());
  vector<int> a;
  while (!s.empty()) {
    int x = *s.begin();
    s.erase(s.begin());
    if (spf[x] == x) {
      a.emplace_back(prime[x]);
      s.erase(s.find(prime[x]));
    } else {
      a.emplace_back(x);
      s.erase(s.find(x / spf[x]));
    }
  }
  cout << a << "\n";
  return;
}
int main() {
  clock_t time_req = clock();
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  pre_prime();
  int tc = 1;
  while (tc--) __sol();
  time_req = clock() - time_req;
  return 0;
}
