#include <bits/stdc++.h>
using namespace std;
long long int buang[2750140], id[2750140];
bool valid[2750140];
int main() {
  long long int n, cnt = 0, a[400010], temp, prima[200010], b, c;
  vector<long long int> ans;
  memset(valid, true, sizeof valid);
  valid[1] = false;
  for (long long int i = 2; i < 2750132; i++)
    if (valid[i]) {
      prima[cnt] = i;
      cnt++;
      id[i] = cnt;
      temp = i * i;
      while (temp < 2750131) {
        valid[temp] = false;
        temp += i;
      }
    }
  scanf("%lld", &n);
  temp = n + n;
  for (long long int i = 0; i < temp; i++) scanf("%lld", &a[i]);
  sort(a, a + temp);
  memset(buang, 0, sizeof buang);
  for (long long int i = temp - 1; i >= 0; i--) {
    b = a[i];
    if (buang[b] > 0)
      buang[b]--;
    else if (valid[b]) {
      c = id[b];
      ans.push_back(c);
      buang[c]++;
    } else {
      ans.push_back(b);
      for (long long int j = 0; j < cnt; j++) {
        c = prima[j];
        if (b % c == 0) {
          buang[b / c]++;
          break;
        }
      }
    }
  }
  for (long long int i = 0; i < n; i++) {
    if (i > 0) putchar(' ');
    printf("%lld", ans[i]);
  }
  printf("\n");
  return 0;
}
