local mce, mfl, msq, mmi, mma, mab = math.ceil, math.floor, math.sqrt, math.min, math.max, math.abs local function getprimes(x) local primes = {} local allnums = {} for i = 1, x do allnums[i] = true end for i = 2, x do if allnums[i] then table.insert(primes, i) local lim = mfl(x / i) for j = 2, lim do allnums[j * i] = false end end end return primes end local function getdivisorparts(x, primes) local prime_num = #primes local tmp = {} local lim = mce(msq(x)) local primepos = 1 local dv = primes[primepos] while primepos <= prime_num and dv <= lim do if x % dv == 0 then x = mfl(x / dv) local cnt = 1 while x % dv == 0 do x = mfl(x / dv) cnt = cnt + 1 end tmp[dv] = cnt lim = mce(msq(x)) end if primepos == prime_num then break end primepos = primepos + 1 dv = primes[primepos] end if x ~= 1 then tmp[x] = 1 end return tmp end local primes = getprimes(400000) local q = io.read("*n") for iq = 1, q do local x = io.read("*n") local dvp = getdivisorparts(x, primes) local v = false for i = 1, #primes do local p = primes[i] if dvp[p] then local z = 1 for j = 0, dvp[p] do z = z * p end if v then v = mmi(v, z) else v = z end else if v then v = mmi(v, p) else v = p end break end end local z = 1LL * v z = tostring(z * x):gsub("LL", "") print(z) end