#include <bits/stdc++.h>
#define endl '\n'
//#pragma GCC optimize ("O3")
//#pragma GCC target ("sse4")
using namespace std;
template<class T, class T2> inline int chkmax(T &x, const T2 &y) { return x < y ? x = y, 1 : 0; }
template<class T, class T2> inline int chkmin(T &x, const T2 &y) { return x > y ? x = y, 1 : 0; }
const int MAXN = (1 << 10);
int n;
int a[MAXN][MAXN];
void read()
{
int v;
cin >> v;
n = sqrt(v);
while(n * n < v) n++;
while(n * n > v) n--;
for(int i = 0; i < n; i++)
for(int j = 0; j < n; j++)
cin >> a[i][j];
}
int cnt[MAXN << 13];
void solve()
{
for(int i = 0; i < n; i++)
for(int j = 0; j < n; j++)
cnt[a[i][j]]++;
vector<int> cands;
for(int i = 0; i < n; i++)
for(int j = 0; j < n; j++)
{
int x = sqrt(a[i][j]);
while(x * x < a[i][j]) x++;
while(x * x > a[i][j]) x--;
if(x * x == a[i][j])
cands.push_back(x);
}
sort(cands.begin(), cands.end());
vector<int> answer;
for(int i: cands)
{
bool ok = 1;
for(int j: answer)
{
if(cnt[i * j] < 2) ok = 0;
cnt[i * j] -= 2;
}
if(ok && cnt[i * i])
{
cnt[i * i]--;
answer.push_back(i);
}
else
for(int j: answer)
cnt[i * j] += 2;
}
for(int i: answer)
cout << i << " ";
cout << endl;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
read();
solve();
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CiNkZWZpbmUgZW5kbCAnXG4nCgovLyNwcmFnbWEgR0NDIG9wdGltaXplICgiTzMiKQovLyNwcmFnbWEgR0NDIHRhcmdldCAoInNzZTQiKQoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKdGVtcGxhdGU8Y2xhc3MgVCwgY2xhc3MgVDI+IGlubGluZSBpbnQgY2hrbWF4KFQgJngsIGNvbnN0IFQyICZ5KSB7IHJldHVybiB4IDwgeSA/IHggPSB5LCAxIDogMDsgfQp0ZW1wbGF0ZTxjbGFzcyBULCBjbGFzcy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