N=int(input()) A=list(map(int,input().split())) M=10**6+3 C=[0]*M for i in range(N): C[A[i]]+=1 X=[0]*M for i in range(1,M): for j in range(i,M,i): X[i]+=C[j] ANS=[0]*(N+1) for i in range(M): ANS[X[i]]=max(ANS[X[i]],i) for i in range(N-1,-1,-1): ANS[i]=max(ANS[i],ANS[i+1]) for i in range(N): print(ANS[N-i])