import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); String[] sa = br.readLine().split(" "); int[] a = new int[n]; for (int i = 0; i < n; i++) { a[i] = Integer.parseInt(sa[i]); } br.close(); Eratosthenes era = new Eratosthenes(1000000); int[] cnt = new int[1000001]; Map> map = new HashMap<>(); for (int i = 0; i < n; i++) { if (era.isSosuu(a[i])) { cnt[1]++; cnt[a[i]]++; } else { List list = map.get(a[i]); if (list == null) { list = divList(a[i]); map.put(a[i], list); } for (int e : list) { cnt[e]++; } } } int[] ans = new int[n]; for (int i = 1000000; i > 0; i--) { if (cnt[i] > 0) { int x = n - cnt[i]; if (ans[x] == 0) { ans[x] = i; } } } for (int i = 1; i < n; i++) { ans[i] = Math.max(ans[i], ans[i - 1]); } PrintWriter pw = new PrintWriter(System.out); for (int i : ans) { pw.println(i); } pw.flush(); } static List divList(int n) { List list = new ArrayList<>(); int end = (int) Math.sqrt(n); for (int i = 1; i <= end; i++) { if (n % i == 0) { list.add(i); } } int i = end * end == n ? list.size() - 2 : list.size() - 1; for ( ; i >= 0; i--) { list.add(n / list.get(i)); } return list; } static class Eratosthenes { int[] div; public Eratosthenes(int n) { div = new int[n + 1]; if (n < 2) return; div[0] = -1; div[1] = -1; int end = (int) Math.sqrt(n) + 1; for (int i = 2; i <= end; i++) { if (div[i] == 0) { div[i] = i; for (int j = i * i; j <= n; j+=i) { if (div[j] == 0) div[j] = i; } } } for (int i = end + 1; i <= n; i++) { if (div[i] == 0) div[i] = i; } } public Map bunkai(int x) { Map soinsu = new HashMap<>(); while (x > 1) { Integer d = div[x]; soinsu.put(d, soinsu.getOrDefault(d, 0) + 1); x /= d; } return soinsu; } public boolean isSosuu(int x) { return div[x] == x; } } }