import math


def solve(N: int) -> tuple:
    pq = 0
    i = 2
    while not pq:
        if N % i == 0:
            pq = i
        i += 1
    pq2 = N // pq
    if math.sqrt(pq2) == int(math.sqrt(pq2)):
        p = int(math.sqrt(pq2))
        q = pq
    else:
        p = pq
        q = N // p**2
    return (p, q)


T = int(input())
for _ in range(T):
    N = int(input())
    p, q = solve(N)
    print(p, q)
