#include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;
int N = 163842, status[163842]= {0};
int main()
{
    int  i, j, sqrtN,count,k,t;
    cin>>t;
    while(t--)
    {
    cin>>k;
    count=0;
    sqrtN = int ( sqrt((double) N ));
    for( i = 3; i <= sqrtN; i += 2 )
    {
        if( status[i] == 0 )
        {
            for( j = i * i; j <= N; j += i )
            {
                status[j] = 1;
            }
        }
    }
    if(k==1)
    cout<<2<<endl;
    else
    {
    for( i = 3; i <= N; i += 2 )
    {
        if(status[i]==0)
        {
            count++;
            if(count==k-1)
            {
                cout<<i<<endl;
                break;
            }
            
        }
    }
    }
    
    }
}