#C2040. Checkpoint Product Indices
Checkpoint Product Indices
Checkpoint Product Indices
You are given an integer \(p\). Monocarp wants to pass a series of checkpoints such that the product of their indices equals \(p\). A valid solution exists only if \(p\) can be expressed as a product of at least two numbers (i.e. it has at least two factors). In this problem, you are required to output one possible set of checkpoint indices that multiply to \(p\). If there is no such valid set (for example, when \(p\) is prime or equal to 1), output -1.
Note: The checkpoint indices can be interpreted as the prime factors of \(p\) if \(p\) has at least two factors. For instance, if \(p = 2023\), one valid answer is 7 17 17
since \(2023 = 7 \times 17 \times 17\). The order of the factors is not important.
inputFormat
The input is read from standard input (stdin).
The first line contains a single integer (t) representing the number of test cases. Each of the next (t) lines contains one integer (p).
outputFormat
For each test case, print one line to standard output (stdout). If a valid set of checkpoint indices exists, output the numbers separated by a space. Otherwise, print -1.## sample
4
3
2023
16
1
-1
7 17 17
2 2 2 2
-1
</p>