atcoder#ABC284D. [ABC284D] Happy New Year 2023

[ABC284D] Happy New Year 2023

Score : 400400 points

Problem Statement

You are given a positive integer NN. It is known that NN can be represented as N=p2qN=p^2q using two different prime numbers pp and qq.

Find pp and qq.

You have TT test cases to solve.

Constraints

  • All values in the input are integers.
  • 1T101\leq T\leq 10
  • 1N9×10181\leq N \leq 9\times 10^{18}
  • NN can be represented as N=p2qN=p^2q using two different prime numbers pp and qq.

Input

The input is given from Standard Input in the following format, where testi\text{test}_i represents the ii-th test case:

TT

test1\text{test}_1

test2\text{test}_2

\vdots

testT\text{test}_T

Each test case is in the following format:

NN

Output

Print TT lines.

The ii-th (1iT)(1\leq i \leq T) line should contain pp and qq for the ii-th test case, separated by a space. Under the constraints of this problem, it can be proved that the pair of prime numbers pp and qq such that N=p2qN=p^2q is unique.

3
2023
63
1059872604593911
17 7
3 7
104149 97711

For the first test case, we have N=2023=172×7N=2023=17^2\times 7. Thus, p=17p=17 and q=7q=7.