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
pratham_1:
20170723 15:25:29
AC 0.04s:) 

arvind002:
20170612 21:52:43
At least three "distinct prime factors" :(.


tusharuppal:
20170601 14:09:22
use simple sieve and use the multiple index of array smartly.... ;) 

horizon121:
20170524 23:26:57
Sieve + lookup table thats all 

chinmay0906:
20170507 14:58:46
200th 

anurag_tangri:
20170414 15:23:12
AC IN ONE GO:) 

sarthak_8:
20170406 12:59:27
@scorpion_ajay How to do it without Sieve? 

scorpion_ajay:
20170311 19:47:15
no sieve, nothing, its just too simple... play smart.


nilabja16180:
20170310 11:15:27
AC in ONE GO 0.00sec!


supercool2204:
20161201 08:27:26
see <snip>

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 