A Kitten on the Fence

No attempts yetTime limit5sMemory limit128 MB

Problem

A little kitten has climbed onto a fence and is hopping along it.

The fence is made of N pickets spaced evenly around a circle. The kitten hops along the fence K pickets at a time. For example, when N = 8 and K = 3 the kitten lands on the pickets 1, 4, 7, 2, ... in that order. The kitten keeps hopping as long as it lands on a picket it has not visited yet. The moment it lands on a picket it has already stepped on, it climbs straight down off the fence.

Given the number of pickets N, find every value of K (1KN1 \le K \le N) for which the kitten, hopping in the way described above, steps on every picket of the fence.

Input

The first line contains the number of test sets Z (1Z101 \le Z \le 10). The descriptions of the sets then follow.

Each set consists of a single line containing the natural number N (1N10000001 \le N \le 1000000) described above.

Output

For each set, print on its own line all values of K that satisfy the condition, in increasing order. Separate adjacent numbers with a single space and do not print a trailing space at the end of the line.