mod = 1000000007 eps = 10**-9 NN = 10 ** 6 def main(): import sys input = sys.stdin.readline div = [[] for _ in range(NN + 1)] for i in range(1, NN+1): for x in range(1, NN+1): if i * x > NN: break div[i*x].append(i) N = int(input()) A = list(map(int, input().split())) cnt = [N] * (NN+1) for a in A: for d in div[a]: cnt[d] -= 1 ans = [1] * (N+1) for x in range(1, NN+1): k = cnt[x] ans[k] = x for i in range(1, N+1): ans[i] = max(ans[i], ans[i-1]) for i in range(N): print(ans[i]) if __name__ == '__main__': main()