import java.util.*;
import java.io.*;

public class Main {
    public static void main (String[]args){
        
        Scanner read = new Scanner(System.in);
        long []Primes=new long [5000001];
        int sum =0,i=0,c;
        int t = Integer.parseInt(read.nextLine());
        boolean flag = true;
        long start, end,tester,n,counter=1;
        double root;
        String string;
        
        while (counter<=t){
             string = read.nextLine();
             if ("".equals(string)){
                 break;
             }
             n = Long.parseLong(string);
             if(n>=1 && n<= 5000000){
             Primes[0] = 2;
             sum=0;
             for (c=2,i=0;i!=n;c++,flag=true){
                 root = (int)Math.sqrt(c);
                 for(int q=0;q<=i&&Primes[q]<=root;q++){
                     tester = c % Primes[q];
                     if (tester == 0){
                            flag = false;
                            break;   
                     } 
                 }
                 if (flag == true){
                        Primes[i+1] = c;
                        i++;
                 }
             }
             if (i == n){
                System.out.println(Primes[i]);
            }
             counter++;
             }
        }
    }
}