#C902. Unique Prime Factors

    ID: 53067 Type: Default 1000ms 256MiB

Unique Prime Factors

Unique Prime Factors

You are given an integer and your task is to compute its unique prime factors in ascending order. For each test case, output the prime factors separated by a single space. If no prime factors exist (for example, when the number is 1), output an empty line.

The mathematical formulation is as follows: Given an integer \( n \), find all primes \( p \) such that \( p \mid n \) and output them in increasing order. That is, if \( n = p_1^{a_1}\,p_2^{a_2}\,\cdots\,p_k^{a_k} \) then print \( p_1, p_2, \ldots, p_k \) with \( p_1 < p_2 < \cdots < p_k \).

inputFormat

The first line contains an integer \( T \) denoting the number of test cases. Then follows \( T \) lines, each containing a single integer \( n \), where \( n \) is the number for which you must compute the unique prime factors.

Example:
Input:
2 28 45

outputFormat

For each test case, print a single line containing the list of unique prime factors of the corresponding integer in ascending order, separated by a space. If a number has no prime factors (e.g. when \( n = 1 \)), print an empty line.

Example:
Output:
2 7 3 5

## sample
2
28
45
2 7

3 5

</p>