Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/sonlar-eng-kichik-tub-boluvchi

Smallest prime divisor

Easy 1000 ms 128 MB 31%
Share

You are given $q$ positive integers. For each of them find its smallest prime divisor. For example, the smallest prime divisor of $35$ is $5$, and the prime $7$ is its own smallest prime divisor.

Under every number, its smallest prime divisor

Input

The first line contains a positive integer $q$. The second line contains $q$ positive integers $n_{i}$ separated by spaces.

Output

One line with $q$ numbers separated by spaces — the smallest prime divisor of each.

Note

$1 \le q \le 10^{5}$
$2 \le n_{i} \le 10^{6}$

Examples

Input #1
5
12 7 35 49 2
Output #1
2 7 5 7 2
Input #2
1
1000000
Output #2
2

Sign in to submit a solution

Signing up is free and takes a minute.