#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*/ counting_sort(long long *, long long *, long long *,
                                 long long);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, long long *);
int main() {
  long long int i, j, k;
  long long int n, t;
  long long int arr[100000], res[100000], dup[100000];
  scanf("%lld", &t);
  while (t--) {
    scanf("%lld", &n);
    for (j = 1; j <= n; j++) {
      scanf("%lld", &arr[j]);
    }
    counting_sort(arr, dup, res, n);
    for (k = 1; k <= n; k++) {
      printf("%lld ", res[k]);
    }
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x249f30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
lea    -0x30(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x30(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x30(%rbp)
cmp    $0x0,%rax
je     1232 <main+0x102>
lea    0xe8e(%rip),%rdi
lea    -0x28(%rbp),%rsi
call   1050 <scanf@plt>
movq   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x28(%rbp),%rax
jg     11c0 <main+0x90>
mov    -0x18(%rbp),%rax
lea    -0xc3530(%rbp),%rsi
shl    $0x3,%rax
add    %rax,%rsi
lea    0xe56(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1183 <main+0x53>
lea    -0xc3530(%rbp),%rdi
lea    -0x249f30(%rbp),%rsi
lea    -0x186a30(%rbp),%rdx
mov    -0x28(%rbp),%rcx
call   1040 <counting_sort@plt>
movq   $0x1,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jg     121f <main+0xef>
mov    -0x20(%rbp),%rax
mov    -0x186a30(%rbp,%rax,8),%rsi
ff
lea    0xdfe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    11e6 <main+0xb6>
lea    0xde5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1152 <main+0x22>
xor    %eax,%eax
add    $0x249f30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x249f18,%rsp
lea    0xea8(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1060 <scanf@plt>
subq   $0x1,0x8(%rsp)
jae    117e <main+0x3e>
xor    %eax,%eax
add    $0x249f18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe7b(%rip),%r12
lea    0x10(%rsp),%r13
lea    0xe74(%rip),%rbp
jmp    11b2 <main+0x72>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
subq   $0x1,0x8(%rsp)
jb     116a <main+0x2a>
mov    %r12,%rdi
mov    %rsp,%rsi
call   1060 <scanf@plt>
mov    (%rsp),%rcx
test   %rcx,%rcx
jle    11fc <main+0xbc>
lea    0xc3518(%rsp),%r14
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %r14,%rsi
call   1060 <scanf@plt>
mov    (%rsp),%rcx
add    $0x1,%r15
add    $0x8,%r14
cmp    %rcx,%r15
jl     11e0 <main+0xa0>
lea    0xc3510(%rsp),%rdi
lea    0x186a10(%rsp),%rsi
mov    %r13,%rdx
call   1050 <counting_sort@plt>
cmpq   $0x0,(%rsp)
jle    11a0 <main+0x60>
xor    %ebx,%ebx
nopl   (%rax)
mov    0x18(%rsp,%rbx,8),%rsi
mov    %rbp,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    (%rsp),%rbx
jl     1220 <main+0xe0>
jmp    11a0 <main+0x60>

LLVM IR (-O0):
@.str = [5 x i8] c"%lld\00"
@.str.1 = [6 x i8] c"%lld \00"
@.str.2 = [2 x i8] c"\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 [100000 x i64]
%8 = alloca [100000 x i64]
%9 = alloca [100000 x i64]
store i32 0, i32* %1
%10 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %6)
br label %11
11: ; preds = %46, %0
%12 = load i64, i64* %6
%13 = add nsw i64 %12, -1
store i64 %13, i64* %6
%14 = icmp ne i64 %12, 0
br i1 %14, label %15, label %48
15: ; preds = %11
%16 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %5)
store i64 1, i64* %3
br label %17
17: ; preds = %25, %15
%18 = load i64, i64* %3
%19 = load i64, i64* %5
%20 = icmp sle i64 %18, %19
br i1 %20, label %21, label %28
21: ; preds = %17
%22 = load i64, i64* %3
%23 = getelementptr inbounds [100000 x i64], [100000 x i64]* %7, i64 0, i64 %22
%24 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %23)
br label %25
25: ; preds = %21
%26 = load i64, i64* %3
%27 = add nsw i64 %26, 1
store i64 %27, i64* %3
br label %17
28: ; preds = %17
%29 = getelementptr inbounds [100000 x i64], [100000 x i64]* %7, i64 0, i64 0
%30 = getelementptr inbounds [100000 x i64], [100000 x i64]* %9, i64 0, i64 0
%31 = getelementptr inbounds [100000 x i64], [100000 x i64]* %8, i64 0, i64 0
%32 = load i64, i64* %5
%33 = call i32 @counting_sort(i64* %29, i64* %30, i64* %31, i64 %32)
store i64 1, i64* %4
br label %34
34: ; preds = %43, %28
%35 = load i64, i64* %4
%36 = load i64, i64* %5
%37 = icmp sle i64 %35, %36
br i1 %37, label %38, label %46
38: ; preds = %34
%39 = load i64, i64* %4
%40 = getelementptr inbounds [100000 x i64], [100000 x i64]* %8, i64 0, i64 %39
%41 = load i64, i64* %40
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 %41)
br label %43
43: ; preds = %38
%44 = load i64, i64* %4
%45 = add nsw i64 %44, 1
store i64 %45, i64* %4
br label %34
46: ; preds = %34
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %11
48: ; preds = %11
ret i32 0
}

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