func main() var primes: []bool :: sieve(5000000) func sieve(n: int): []bool var isPrime: []bool :: [true].repeat(n + 1) do isPrime[0] :: false do isPrime[1] :: false for i(2, n + 1) if(isPrime[i]) var j: int :: i * i while(j <= n) do isPrime[j] :: false do j :+ i end while end if end for ret isPrime end func var t: int :: cui@inputInt() for(1, t) do cui@inputInt() var p: int :: cui@inputInt() var ans: int :: primes[p] ?(1, -1) do cui@print("\{ans}\n") end for end func