import std.stdio, std.array, std.string, std.conv, std.algorithm; import std.typecons, std.range, std.random, std.math, std.container; import std.numeric, std.bigint, core.bitop; void main() { auto T = readln.chomp.to!int; long[] P; auto table = new bool[](10^^6); for (long i = 2; i * i <= 10L^^11; ++i) { if (table[i.to!int]) continue; P ~= i; for (long j = i * 2; j * j <= 10L ^^ 11; j += i) { table[j.to!int] = true; } } while (T--) { auto X = readln.chomp.to!long; long ans = 1L << 59; foreach (i; 0..P.length.to!int) { if (X % P[i] != 0) { writeln(min(ans, X * P[i])); break; } else { long count = 0; long Y = X; while (Y % P[i] == 0) { Y /= P[i]; count += 1; } ans = min(ans, X * P[i]^^(count+1)); } } } }