def prime_factor(n) res = Hash.new(0) i = 2 while i * i <= n do while n % i == 0 do res[i] += 1 n /= i end i += 1 end res[n] += 1 if n != 1 res end def prime?(n) i = 2 while i * i <= n do return false if n % i == 0 i += 1 end n != 1 end T = gets.to_i X = [] T.times { X << gets.to_i } ans = [] X.each {|x| f = prime_factor(x) i = 2 while not prime?(i) or f.include?(i) do i += 1 end a = [i] f.each {|k, v| a << k**(v+1) } ans << x * a.min } puts ans