#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(x) (x).begin(), (x).end()
#define f(i, n) for (int i = 0; i < n; i++)
#define trace(x) cerr << #x << ": " << x << '\n'
int n;
vector<int> v;
int gcd(int a, int b)
{
if (a == 0)
return b;
return gcd(b % a, a);
}
const int N1 = 41, N2 = 41;
int dp[N1][N2];
int fun(int i, int c)
{
if (i == n)
{
if (c == 0)
return 0;
else
return 1;
}
if (c == 0)
return 0;
if (dp[i][c] != -1)
return dp[i][c];
int ans = fun(i + 1, c);
ans = max(ans, gcd(v[i], fun(i + 1, c - 1)));
return dp[i][c] = ans;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> n;
v.resize(n);
for (auto &x : v)
{
cin >> x;
}
memset(dp, -1, sizeof(dp));
for (int k = 1; k <= n; k++)
cout << fun(0, k) << " ";
return 0;
}