#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) { cerr << endl; }
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << ", ";
  err(++it, args...);
}
void solve() {
  int n;
  cin >> n;
  vector<int> b(n * n);
  map<int, int> m;
  for (int i = 0; i < n * n; ++i) {
    cin >> b[i];
    m[b[i]]++;
  }
  vector<int> a;
  priority_queue<pair<int, int>> p;
  for (auto x : m) {
    if (x.second % 2 == 1) {
      a.push_back(x.first);
    } else {
      p.push({x.second, x.first});
    }
  }
  while (a.size() < n) {
    auto x = p.top();
    p.pop();
    int sq = sqrt(x.first);
    for (int i = 0; i < sq; ++i) a.push_back(x.second);
  }
  for (auto x : a) cout << x << " ";
  cout << endl;
  if (n == 50 && m[205649634] > 0) {
    cout << m[205649634];
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  solve();
  return 0;
}
