N = int(input()) A = list(map(int,input().split())) cnt = [0 for _ in range(10**6+1)] for a in A: cnt[a] += 1 filed = [0 for _ in range(N+1)] for g in range(1,10**6+1): m = 10 ** 6 // g tmp = 0 for i in range(1,m+1): tmp += cnt[g * i] filed[N-tmp] = g def max_lift(List): rev = [0 for _ in range(len(List))] for i in range(len(List)): if i == 0: rev[i] = List[i] else: rev[i] = max(rev[i-1],List[i]) return rev ans = max_lift(filed) for k in range(N): print(ans[k])