#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned long long);
int /*<<< orphan*/ scanf(char *, unsigned long long *);
int main() {
  unsigned long long N, T;
  scanf("%Lu", &T);
  while (T--) {
    unsigned long long i;
    unsigned long long n = 2, s = 0;
    int status = 0, flag = 0;
    scanf("%Lu", &N);
    while (status == 0) {
      flag = 0;
      for (i = 2; i <= n / 2; ++i) {
        if (n % i == 0) {
          flag = 1;
          break;
        }
      }
      if (flag == 0) {
        s++;
        if (s == N) {
          status = 1;
        }
      }
      if (status == 0)
        n++;
    }
    printf("%Lu\n", n);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x18(%rbp)
cmp    $0x0,%rax
je     124c <main+0x12c>
movq   $0x2,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
lea    0xe83(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x34(%rbp)
jne    1237 <main+0x117>
movl   $0x0,-0x38(%rbp)
movq   $0x2,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%rcx
shr    $0x1,%rcx
cmp    %rcx,%rax
ja     11ec <main+0xcc>
mov    -0x28(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x20(%rbp)
cmp    $0x0,%rdx
jne    11d6 <main+0xb6>
movl   $0x1,-0x38(%rbp)
jmp    11ec <main+0xcc>
jmp    11db <main+0xbb>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    119f <main+0x7f>
cmpl   $0x0,-0x38(%rbp)
jne    121c <main+0xfc>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x10(%rbp),%rax
jne    1217 <main+0xf7>
movl   $0x1,-0x34(%rbp)
jmp    121c <main+0xfc>
cmpl   $0x0,-0x34(%rbp)
jne    1232 <main+0x112>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1186 <main+0x66>
mov    -0x28(%rbp),%rsi
lea    0xdc2(%rip),%rdi
call   1030 <printf@plt>
jmp    113f <main+0x1f>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xece(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1040 <scanf@plt>
subq   $0x1,0x8(%rsp)
jae    1152 <main+0x32>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
lea    0xea7(%rip),%r14
lea    0x10(%rsp),%r15
lea    0xe9f(%rip),%r12
jmp    1180 <main+0x60>
nopw   0x0(%rax,%rax,1)
mov    %r12,%rdi
call   1030 <printf@plt>
subq   $0x1,0x8(%rsp)
jb     1144 <main+0x24>
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    $0x2,%esi
mov    0x10(%rsp),%r8
xor    %edi,%edi
jmp    11ad <main+0x8d>
nopl   0x0(%rax)
add    $0x1,%rdi
cmp    %r8,%rdi
je     1170 <main+0x50>
add    $0x1,%rsi
cmp    $0x4,%rsi
jb     11a0 <main+0x80>
mov    %rsi,%rax
shr    %rax
mov    $0x1,%ebx
sub    %rax,%rbx
mov    $0x2,%ecx
cs nopw 0x0(%rax,%rax,1)
mov    %rsi,%rax
or     %rcx,%rax
shr    $0x20,%rax
je     11f0 <main+0xd0>
mov    %rsi,%rax
xor    %edx,%edx
div    %rcx
jmp    11f6 <main+0xd6>
cs nopw 0x0(%rax,%rax,1)
mov    %esi,%eax
xor    %edx,%edx
div    %ecx
test   %rdx,%rdx
je     11a9 <main+0x89>
lea    (%rbx,%rcx,1),%rax
add    $0x1,%rax
add    $0x1,%rcx
cmp    $0x2,%rax
jne    11d0 <main+0xb0>
jmp    11a0 <main+0x80>

LLVM IR (-O0):
@.str = [4 x i8] c"%Lu\00"
@.str.1 = [5 x i8] c"%Lu\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
%9 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %3)
br label %10
10: ; preds = %53, %0
%11 = load i64, i64* %3
%12 = add i64 %11, -1
store i64 %12, i64* %3
%13 = icmp ne i64 %11, 0
br i1 %13, label %14, label %56
14: ; preds = %10
store i64 2, i64* %5
store i64 0, i64* %6
store i32 0, i32* %7
store i32 0, i32* %8
%15 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %2)
br label %16
16: ; preds = %52, %14
%17 = load i32, i32* %7
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %53
19: ; preds = %16
store i32 0, i32* %8
store i64 2, i64* %4
br label %20
20: ; preds = %32, %19
%21 = load i64, i64* %4
%22 = load i64, i64* %5
%23 = udiv i64 %22, 2
%24 = icmp ule i64 %21, %23
br i1 %24, label %25, label %35
25: ; preds = %20
%26 = load i64, i64* %5
%27 = load i64, i64* %4
%28 = urem i64 %26, %27
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %31
30: ; preds = %25
store i32 1, i32* %8
br label %35
31: ; preds = %25
br label %32
32: ; preds = %31
%33 = load i64, i64* %4
%34 = add i64 %33, 1
store i64 %34, i64* %4
br label %20
35: ; preds = %30, %20
%36 = load i32, i32* %8
%37 = icmp eq i32 %36, 0
br i1 %37, label %38, label %46
38: ; preds = %35
%39 = load i64, i64* %6
%40 = add i64 %39, 1
store i64 %40, i64* %6
%41 = load i64, i64* %6
%42 = load i64, i64* %2
%43 = icmp eq i64 %41, %42
br i1 %43, label %44, label %45
44: ; preds = %38
store i32 1, i32* %7
br label %45
45: ; preds = %44, %38
br label %46
46: ; preds = %45, %35
%47 = load i32, i32* %7
%48 = icmp eq i32 %47, 0
br i1 %48, label %49, label %52
49: ; preds = %46
%50 = load i64, i64* %5
%51 = add i64 %50, 1
store i64 %51, i64* %5
br label %52
52: ; preds = %49, %46
br label %16
53: ; preds = %16
%54 = load i64, i64* %5
%55 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 %54)
br label %10
56: ; preds = %10
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%Lu\00"
@.str.1 = [5 x i8] c"%Lu\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca i64
%3 = bitcast i64* %1 to i8*
%4 = bitcast i64* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %2)
%6 = load i64, i64* %2
%7 = add i64 %6, -1
store i64 %7, i64* %2
%8 = icmp eq i64 %6, 0
br i1 %8, label %36, label %9
9: ; preds = %0, %31
%10 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %1)
%11 = load i64, i64* %1
br label %12
12: ; preds = %28, %9
%13 = phi i64 [ 0, %9 ], [ %29, %28 ]
%14 = phi i64 [ 2, %9 ], [ %30, %28 ]
%15 = icmp ult i64 %14, 4
br i1 %15, label %25, label %16
16: ; preds = %12
%17 = lshr i64 %14, 1
br label %21
18: ; preds = %21
%19 = add nuw i64 %22, 1
%20 = icmp eq i64 %22, %17
br i1 %20, label %25, label %21
21: ; preds = %16, %18
%22 = phi i64 [ %19, %18 ], [ 2, %16 ]
%23 = urem i64 %14, %22
%24 = icmp eq i64 %23, 0
br i1 %24, label %28, label %18
25: ; preds = %18, %12
%26 = add i64 %13, 1
%27 = icmp eq i64 %26, %11
br i1 %27, label %31, label %28
28: ; preds = %21, %25
%29 = phi i64 [ %26, %25 ], [ %13, %21 ]
%30 = add i64 %14, 1
br label %12
31: ; preds = %25
%32 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 %14)
%33 = load i64, i64* %2
%34 = add i64 %33, -1
store i64 %34, i64* %2
%35 = icmp eq i64 %33, 0
br i1 %35, label %36, label %9
36: ; preds = %31, %0
ret i32 0
}