#C6372. Optimal Garden Dimensions

    ID: 50125 Type: Default 1000ms 256MiB

Optimal Garden Dimensions

Optimal Garden Dimensions

You are given an integer N representing the area of a rectangular garden. Your task is to determine the dimensions l (length) and w (width) such that \(l \times w = N\) and the absolute difference \(|l - w|\) is minimized. In case there are multiple solutions, choose the pair where l ≥ w.

For example, when N = 12, the optimal dimensions are (4, 3) because \(4 \times 3 = 12\) and the difference \(|4 - 3|\) is minimized.

inputFormat

The first line contains an integer T – the number of test cases. Each of the following T lines contains a single integer N representing the area of the garden.

outputFormat

For each test case, output a single line with two space-separated integers representing l and w that meet the requirements.## sample

3
12
20
17
4 3

5 4 17 1

</p>