import java.io.PrintWriter import java.util.* import kotlin.math.* fun PrintWriter.solve() { val size = 100 val isprime = BooleanArray(size) { true } for (p in 2 until size) { if (!isprime[p]) continue var i = 2 while (p * i < size) { isprime[p * i] = false i++ } } val plst = (2 until size).filter { isprime[it] }.toList() val numCases = nextInt() case@ for (_i in 0 until numCases) { val x = nextLong() var min = Long.MAX_VALUE for (p in plst) { if (x % p == 0L) { var y = x var z = p.toLong() while (y % p == 0L) { y /= p z *= p } min = minOf(min, z) } else { min = minOf(min, p.toLong()) } } println(x * min) } } fun main() { val writer = PrintWriter(System.out, false) writer.solve() writer.flush() } // region Scanner private var st = StringTokenizer("") private val br = System.`in`.bufferedReader() fun next(): String { while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine()) return st.nextToken() } fun nextInt() = next().toInt() fun nextLong() = next().toLong() fun nextLine() = br.readLine() fun nextDouble() = next().toDouble() // endregion