using System; using System.Collections.Generic; using System.Linq; namespace Sample { class Program { static void Main(string[] args) { var N = int.Parse(Console.ReadLine()); var A = Console.ReadLine().Split(' ') .Select(x => int.Parse(x)).ToArray(); var MAX_A = A.Max(); var K = new int[N]; for (int i = 0; i < N; i++) { K[i] = 1; } var divs = new int[MAX_A + 1]; for (int i = 0; i <= MAX_A; i++) { divs[i] = 0; } foreach (var a in A) { var arr = CalcDivisors(a); foreach (var x in arr) { divs[x]++; } } for (int i = 0; i <= MAX_A; i++) { if (divs[i] > 0) { K[N - divs[i]] = Math.Max(K[N - divs[i]], i); } } var now = 1; for (int i = 0; i < N; i++) { now = Math.Max(now, K[i]); Console.WriteLine(now); } } static int[] CalcDivisors(int num) { var set = new HashSet(); for (int i = 1; i <= Math.Sqrt(num); i++) { if (num % i == 0) { set.Add(i); set.Add(num / i); } } var arr = set.ToArray(); return arr; } } }