#複数回素因数分解や約数列挙をする場合(n<=10^6) #エラトステネスの篩 m=10**6*+1 eratosthenes=[-1]*(m+1) for i in range(2,m+1): if eratosthenes[i]==-1: eratosthenes[i]=i j=2 while i*j<=m: eratosthenes[i*j]=i j+=1 #n の素因数分解 import collections def fact(n): c=[] while n!=1: k=eratosthenes[n] c.append(k) n//=k #return c return collections.Counter(c) #n の約数列挙 def div(n): s=[1] while n!=1: p=eratosthenes[n] cnt=1 n//=p while eratosthenes[n]==p: cnt+=1 n//=p t=s.copy() for i in t: for j in range(1,cnt+1): s.append(i*(p**j)) return s n=int(input()) a=list(map(int,input().split())) mx=max(a) c=collections.Counter(a) cnt=[0]*(mx+1) for i in c: j=c[i] for k in div(i): cnt[k]+=j ans=[1]*(n) for i in range(2,mx+1): if cnt[i]!=0: ans[n-cnt[i]]=i for i in range(1,n): ans[i]=max(ans[i],ans[i-1]) for i in range(n): print(ans[i])