407503: GYM102803 G Goodbye

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

G. Goodbyetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

"Goodbye to the friends I've had, goodbye to my upstairs neighbor, goodbye to the kids downstairs, and anybody who lend me a favor."

"Or, goodbye to the positive proper divisor?"

That game is popular these days. Two player take turns to choose a specific number and claim it. The player who takes the first turn chooses one positive proper divisor of given $$$n$$$. In the next rounds, player should choose one positive proper divisor (真因数) of the number claimed in the previous round. The player who can't make a choice will win.

Formally, a positive proper divisor of $$$n$$$ is a divisor of $$$n$$$, and it cannot be either $$$1$$$ or $$$n$$$.

Now Chino is going to play this game with David. Chino always wants to win and meanwhile she wants to keep the chosen number as big as possible. If with the given $$$n$$$, Chino will win directly or fail anyway, you should also tell her.

Can you help Chino to choose her answer in the first round?

Input

The first line contains one integer $$$T ~ (1 \leq T \leq 10^3)$$$ denoting the count of testcases.

For each testcase, one line with one integer $$$n ~ (1 \leq n \leq 10^5)$$$ denoting the given $$$n$$$ in one game.

Output

For each testcase, you should output the biggest choice, or $$$0$$$ when Chino will win directly, or $$$-1$$$ when Chino will fail anyway.

ExampleInput
4
3
4
8
666
Output
0
-1
4
111

加入题单

上一题 下一题 算法标签: