import java.util.*;
public class Main {
// mark all prime no
static void primeSieve(boolean prime[]) {
for (int i = 3; i < prime.length; i = i + 2) {
prime[i] = true;
}
for (int i = 3; i <= prime.length; i = i + 2) {
// if the current no is marked
if (prime[i] == true) {
// marked all current no multiple as not prime
for (int j = i * i; j < prime.length; j = j + i) {
prime[j] = false;
}
}
}
prime[2] = true;
prime[0] = prime[1] = false;
}
// using sieve erathosthenes approach
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
boolean[] prime = new boolean[1000000];
primeSieve(prime);
int T = sc.nextInt();
int count = 0;
int num = 0;
while(T!=0) {
int no = sc.nextInt();
for (int i = 2; i <= prime.length; i++) {
if (count == no) {
break;
} else {
if (prime[i] == true) {
num = i;
count++;
}
}
}
no=0;
count=0;
System.out.println(num);
}
}
}