Prime factors - MarisaOJ: Marisa Online Judge

Prime factors

Time limit: 2000 ms
Memory limit: 256 MB
Given $q$ queries, each is an integer $n$, find all prime factors of $n$. ### Input - The first line contains an integer $q$. - The next $q$ line, each line contains an integer $n$. ### Output - Print $q$ lines, $i^{th}$ line contains every prime factors of $i^{th}$ query in ascending order. ### Constraints - $1 \le q \le 5 \times 10^5$. - $2 \le n \le 10^6$. ### Example Input: ``` 2 9 24 ``` Output: ``` 3 2 3 ```