#P1574. 超级数

超级数

Description

Let the number of divisors of xx be f(x)f(x). If i[1,n)Z+,f(n)>f(i)\forall i\in [1,n)\cap \mathbb{Z^+}, f(n)>f(i), then we call nn a supernumber.

Given mm numbers a1,a2,,ama_1, a_2, \ldots, a_m, for each aia_i, output the largest supernumber not exceeding aia_i.

Input Format

The first line has one integer representing mm.

From line 22 to line (m+1)(m+1), each line contains one integer, where the integer on line (i+1)(i+1) is aia_i.

Output Format

Output mm lines, one integer per line, where the ii-th line is the largest supernumber not exceeding aia_i.

2
8
13
6
12

Hint

Constraints

  • For 40% of the testdata, m=1m=1.
  • For 50% of the testdata, ai1000a_i\le 1000.
  • For 70% of the testdata, ai2×107a_i\le 2\times 10^7.
  • For 100% of the testdata, m105m\le 10^5, ai1017a_i\le 10^{17}.

Translated by ChatGPT 5