require'prime' N=gets.to_i a=gets.split.map(&:to_i) div=Hash.new{|h,x| h[x]=x.prime_division.inject([1]){|s,(p,k)| s+s.flat_map{|i|(1..k).map{|j|i*p**j}} } } mul=(0..a.max).map{[]} a.sort.each{|i| div[i].each{|d| mul[d] << i } } puts ([i=a[0]]+(2..N).map{ i=div[i].map{|d| mul[d].delete_at(mul[d].index i) (t=mul[d][0])?[t/d,t]:[1e9] }.min[1] })*" "