#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*/ free(int *);
int getMin(int *, int);
int *malloc(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ quick_sort(int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int t;
  scanf("%d", &t);
  int *output = malloc(sizeof(int) * t);
  int x[1000000];
  for (size_t i = 0; i < t; i++) {
    int n;
    scanf("%d", &n);
    for (size_t j = 0; j < n; j++) {
      scanf("%d", x + j);
    }
    quick_sort(x, 0, n - 1);
    output[i] = getMin(x, n);
  }
  for (size_t i = 0; i < t; i++) {
    printf("%d\n", output[i]);
  }
  free(output);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3d0930,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe87(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1070 <scanf@plt>
movslq -0x8(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
movq   $0x0,-0x3d0918(%rbp)
mov    -0x3d0918(%rbp),%rax
movslq -0x8(%rbp),%rcx
cmp    %rcx,%rax
jae    1271 <main+0x111>
lea    0xe45(%rip),%rdi
lea    -0x3d091c(%rbp),%rsi
call   1070 <scanf@plt>
movq   $0x0,-0x3d0928(%rbp)
mov    -0x3d0928(%rbp),%rax
movslq -0x3d091c(%rbp),%rcx
cmp    %rcx,%rax
jae    1221 <main+0xc1>
lea    -0x3d0910(%rbp),%rsi
mov    -0x3d0928(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xdfb(%rip),%rdi
call   1070 <scanf@plt>
mov    -0x3d0928(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x3d0928(%rbp)
jmp    11d2 <main+0x72>
lea    -0x3d0910(%rbp),%rdi
mov    -0x3d091c(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
call   1080 <quick_sort@plt>
lea    -0x3d0910(%rbp),%rdi
mov    -0x3d091c(%rbp),%esi
call   1060 <getMin@plt>
mov    %eax,%edx
mov    -0x10(%rbp),%rax
mov    -0x3d0918(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x3d0918(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x3d0918(%rbp)
jmp    11a0 <main+0x40>
movq   $0x0,-0x3d0930(%rbp)
mov    -0x3d0930(%rbp),%rax
movslq -0x8(%rbp),%rcx
cmp    %rcx,%rax
jae    12c1 <main+0x161>
mov    -0x10(%rbp),%rax
mov    -0x3d0930(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xd5e(%rip),%rdi
call   1040 <printf@plt>
mov    -0x3d0930(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x3d0930(%rbp)
jmp    127c <main+0x11c>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x3d0930,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x3d0918,%rsp
lea    0xe88(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1070 <scanf@plt>
mov    0xc(%rsp),%ebx
lea    0x0(,%rbx,4),%edi
call   1050 <malloc@plt>
mov    %rax,%r14
test   %ebx,%ebx
je     124a <main+0xea>
xor    %ebp,%ebp
lea    0xe5a(%rip),%r13
lea    0x10(%rsp),%r12
jmp    11db <main+0x7b>
nopl   (%rax)
add    $0xffffffff,%edx
mov    %r12,%rdi
xor    %esi,%esi
call   1080 <quick_sort@plt>
mov    0x8(%rsp),%esi
mov    %r12,%rdi
call   1060 <getMin@plt>
mov    %eax,(%r14,%rbp,4)
add    $0x1,%rbp
movslq 0xc(%rsp),%rax
cmp    %rax,%rbp
jae    121f <main+0xbf>
mov    %r13,%rdi
lea    0x8(%rsp),%rsi
call   1070 <scanf@plt>
cmpl   $0x0,0x8(%rsp)
mov    $0x0,%edx
je     11b0 <main+0x50>
mov    %r12,%rbx
xor    %r15d,%r15d
nopw   0x0(%rax,%rax,1)
mov    %r13,%rdi
mov    %rbx,%rsi
call   1070 <scanf@plt>
add    $0x1,%r15
movslq 0x8(%rsp),%rdx
add    $0x4,%rbx
cmp    %rdx,%r15
jb     1200 <main+0xa0>
jmp    11b0 <main+0x50>
test   %eax,%eax
je     124a <main+0xea>
xor    %ebp,%ebp
lea    0xdd7(%rip),%rbx
nopl   0x0(%rax)
mov    (%r14,%rbp,4),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
add    $0x1,%rbp
movslq 0xc(%rsp),%rax
cmp    %rax,%rbp
jb     1230 <main+0xd0>
mov    %r14,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x3d0918,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
%4 = alloca [1000000 x i32]
%5 = alloca i64
%6 = alloca i32
%7 = alloca i64
%8 = alloca i64
store i32 0, i32* %1
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %2
%11 = sext i32 %10 to i64
%12 = mul i64 4, %11
%13 = trunc i64 %12 to i32
%14 = call i32* @malloc(i32 %13)
store i32* %14, i32** %3
store i64 0, i64* %5
br label %15
15: ; preds = %46, %0
%16 = load i64, i64* %5
%17 = load i32, i32* %2
%18 = sext i32 %17 to i64
%19 = icmp ult i64 %16, %18
br i1 %19, label %20, label %49
20: ; preds = %15
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
store i64 0, i64* %7
br label %22
22: ; preds = %32, %20
%23 = load i64, i64* %7
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = icmp ult i64 %23, %25
br i1 %26, label %27, label %35
27: ; preds = %22
%28 = getelementptr inbounds [1000000 x i32], [1000000 x i32]* %4, i64 0, i64 0
%29 = load i64, i64* %7
%30 = getelementptr inbounds i32, i32* %28, i64 %29
%31 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %30)
br label %32
32: ; preds = %27
%33 = load i64, i64* %7
%34 = add i64 %33, 1
store i64 %34, i64* %7
br label %22
35: ; preds = %22
%36 = getelementptr inbounds [1000000 x i32], [1000000 x i32]* %4, i64 0, i64 0
%37 = load i32, i32* %6
%38 = sub nsw i32 %37, 1
%39 = call i32 @quick_sort(i32* %36, i32 0, i32 %38)
%40 = getelementptr inbounds [1000000 x i32], [1000000 x i32]* %4, i64 0, i64 0
%41 = load i32, i32* %6
%42 = call i32 @getMin(i32* %40, i32 %41)
%43 = load i32*, i32** %3
%44 = load i64, i64* %5
%45 = getelementptr inbounds i32, i32* %43, i64 %44
store i32 %42, i32* %45
br label %46
46: ; preds = %35
%47 = load i64, i64* %5
%48 = add i64 %47, 1
store i64 %48, i64* %5
br label %15
49: ; preds = %15
store i64 0, i64* %8
br label %50
50: ; preds = %61, %49
%51 = load i64, i64* %8
%52 = load i32, i32* %2
%53 = sext i32 %52 to i64
%54 = icmp ult i64 %51, %53
br i1 %54, label %55, label %64
55: ; preds = %50
%56 = load i32*, i32** %3
%57 = load i64, i64* %8
%58 = getelementptr inbounds i32, i32* %56, i64 %57
%59 = load i32, i32* %58
%60 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %59)
br label %61
61: ; preds = %55
%62 = load i64, i64* %8
%63 = add i64 %62, 1
store i64 %63, i64* %8
br label %50
64: ; preds = %50
%65 = load i32*, i32** %3
%66 = call i32 @free(i32* %65)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1000000 x i32]
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = shl i32 %6, 2
%8 = call i32* @malloc(i32 %7)
%9 = bitcast [1000000 x i32]* %2 to i8*
%10 = icmp eq i32 %6, 0
br i1 %10, label %40, label %11
11: ; preds = %0
%12 = bitcast i32* %3 to i8*
%13 = getelementptr inbounds [1000000 x i32], [1000000 x i32]* %2, i64 0, i64 0
br label %16
14: ; preds = %21
%15 = icmp eq i32 %29, 0
br i1 %15, label %40, label %42
16: ; preds = %11, %21
%17 = phi i64 [ 0, %11 ], [ %28, %21 ]
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%19 = load i32, i32* %3
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %32
21: ; preds = %32, %16
%22 = phi i32 [ 0, %16 ], [ %37, %32 ]
%23 = add nsw i32 %22, -1
%24 = call i32 @quick_sort(i32* %13, i32 0, i32 %23)
%25 = load i32, i32* %3
%26 = call i32 @getMin(i32* %13, i32 %25)
%27 = getelementptr inbounds i32, i32* %8, i64 %17
store i32 %26, i32* %27
%28 = add nuw i64 %17, 1
%29 = load i32, i32* %1
%30 = sext i32 %29 to i64
%31 = icmp ult i64 %28, %30
br i1 %31, label %16, label %14
32: ; preds = %16, %32
%33 = phi i64 [ %36, %32 ], [ 0, %16 ]
%34 = getelementptr inbounds [1000000 x i32], [1000000 x i32]* %2, i64 0, i64 %33
%35 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %34)
%36 = add nuw i64 %33, 1
%37 = load i32, i32* %3
%38 = sext i32 %37 to i64
%39 = icmp ult i64 %36, %38
br i1 %39, label %32, label %21
40: ; preds = %42, %0, %14
%41 = call i32 @free(i32* %8)
ret i32 0
42: ; preds = %14, %42
%43 = phi i64 [ %47, %42 ], [ 0, %14 ]
%44 = getelementptr inbounds i32, i32* %8, i64 %43
%45 = load i32, i32* %44
%46 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %45)
%47 = add nuw i64 %43, 1
%48 = load i32, i32* %1
%49 = sext i32 %48 to i64
%50 = icmp ult i64 %47, %49
br i1 %50, label %42, label %40
}