AMR11E  Distinct Primes
Arithmancy is Draco Malfoy's favorite subject, but what spoils it for him is that Hermione Granger is in his class, and she is better than him at it. Prime numbers are of mystical importance in Arithmancy, and Lucky Numbers even more so. Lucky Numbers are those positive integers that have at least three distinct prime factors; 30 and 42 are the first two. Malfoy's teacher has given them a positive integer n, and has asked them to find the nth lucky number. Malfoy would like to beat Hermione at this exercise, so although he is an evil git, please help him, just this once. After all, the knowitall Hermione does need a lesson.
Input
The first line contains the number of test cases T. Each of the next T lines contains one integer n.
Output
Output T lines, containing the corresponding lucky number for that test case.
Constraints
1 <= T <= 20
1 <= n <= 1000
Example
Sample Input: 2 1 2 Sample Output: 30 42
hide comments
sarkardchamp:
20210420 23:56:04
which is the third lucky number?


ankay_21:
20201018 17:06:36
**Take Care**  'at least' 

deepak_start:
20200710 17:02:38
precompute and print. 

vritta:
20200420 18:45:41
If stuck, see <snip>


sanket17:
20190714 09:54:03
Brute force will work 

mr_quan1998:
20190705 19:29:12
"At leash" make me cry T_T


aj_254:
20190511 13:23:44
precompute and print. 

raghav6:
20190203 08:12:40
Hint: PreCompute only till 3000 numbers! Last edit: 20190203 08:14:21 

gokul27:
20181218 18:19:32
my 25th!! 

ashimk:
20181209 17:26:55
Simple application of Sieve.

Added by:  Varun Jalan 
Date:  20111215 
Time limit:  3s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: ASM64 
Resource:  Varun Jalan  ICPC Asia regionals, Amritapuri 2011 