408040: GYM102966 D Determine the Winner Marshaland

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

Description

D. Determine the Winner Marshalandtime limit per test0.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

Every seven years, in Marshaland, there is an exciting team-contest among the most daring marshmallows of the place. It consists of finding balls that were previously hidden. But the most appealing thing of this event is the reward.

The fee for enrolling in the contest is one marsh-coin, and that is the initial prize. For every ball a marshmallow team finds, the number of coins to earn doubles. So, after finding the first ball, the competitors are promised to earn 2 coins, after the second, their prize will be 4 coins, and so on. When the time is up, the judges announce exactly one winner team, that is, of course, the group with the greatest number of balls. Then, besides the coins the champion team acquired, the governor adds a bonus of $$$K$$$ coins to the prize.

The oracle of Marshaland, who never fails in her predictions, announced to the local government that she could not foresee the winner, but she had a vision: the number of members of the winner team will be the same as the number of balls they will attain to gather. Besides, this number is certainly a prime number greater than 2.

In prior years, there have been violent incidents within the first-place teams because they do not find a fair way to distribute the money. Thinking of it, the government wants to ensure that teams are shaped by exactly $$$p_1, p_2, \dots, p_j$$$ marshmallows, where the $$$p_i$$$ values are primes that meet the features stated by the oracle. That is why they have come to you; they know about your outstanding programming skills and they are asking you to find all the different $$$p_i$$$, knowing only the bonus the governor will add to the prize.

Input

The first line of input contains a single integer number $$$T$$$ ($$$1 \leq T \leq 1000$$$), representing the number of cases. Each of the next $$$T$$$ lines contains a single integer, $$$K$$$ ($$$0 < K \leq 10^6$$$), representing the bonus coins the governor will add to the prize.

Output

For each case in the input, print a line with all the primes in ascending order that fulfill the oracle's omens. If there are no primes with the requiered conditions, print -1.

ExampleInput
3
2
8
345678
Output
-1
5
5 29 149

加入题单

算法标签: