#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 *, char *);
int /*<<< orphan*/ putchar(char);
scalar_t__ scanf(char *, ...);
int main() {
  int t, i, c;
  char s[21];
  while (scanf("%d", &t) > 0)
    while (t--) {
      scanf("%d", &c);
      for (i = 1; i <= c; i++) {
        scanf("%s", s);
        printf("%20s", s);
        if (i % 4 == 0)
          putchar('\n');
      }
      if (c % 4 != 0)
        putchar('\n');
      putchar('\n');
    }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
cmp    $0x0,%rax
jle    121e <main+0xee>
jmp    1160 <main+0x30>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     1219 <main+0xe9>
lea    0xe85(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     11ec <main+0xbc>
lea    -0x30(%rbp),%rsi
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
lea    -0x30(%rbp),%rsi
lea    0xe50(%rip),%rdi
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11d9 <main+0xa9>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    11de <main+0xae>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    118d <main+0x5d>
mov    -0x10(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     120a <main+0xda>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1160 <main+0x30>
jmp    113f <main+0xf>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0xebb(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
test   %rax,%rax
jle    1218 <main+0xe8>
lea    0xe9f(%rip),%r12
lea    0xc(%rsp),%r15
lea    0xe96(%rip),%r13
lea    0x10(%rsp),%rbx
lea    0xe8d(%rip),%rbp
jmp    118a <main+0x5a>
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
subl   $0x1,0x8(%rsp)
jb     1200 <main+0xd0>
mov    %r12,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    11f0 <main+0xc0>
xor    %r14d,%r14d
jmp    11b9 <main+0x89>
nopl   0x0(%rax,%rax,1)
mov    0xc(%rsp),%eax
cmp    %eax,%r14d
jge    11f0 <main+0xc0>
add    $0x1,%r14d
mov    %r13,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
test   $0x3,%r14b
jne    11b0 <main+0x80>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    11b0 <main+0x80>
nopw   0x0(%rax,%rax,1)
test   $0x3,%al
je     1180 <main+0x50>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1180 <main+0x50>
mov    %r12,%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
test   %rax,%rax
jg     118a <main+0x5a>
xor    %eax,%eax
add    $0x28,%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 = [3 x i8] c"%s\00"
@.str.2 = [5 x i8] c"%20s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [21 x i8]
store i32 0, i32* %1
br label %6
6: ; preds = %42, %0
%7 = call i64 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%8 = icmp sgt i64 %7, 0
br i1 %8, label %9, label %43
9: ; preds = %6
br label %10
10: ; preds = %40, %9
%11 = load i32, i32* %2
%12 = add nsw i32 %11, -1
store i32 %12, i32* %2
%13 = icmp ne i32 %11, 0
br i1 %13, label %14, label %42
14: ; preds = %10
%15 = call i64 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
store i32 1, i32* %3
br label %16
16: ; preds = %31, %14
%17 = load i32, i32* %3
%18 = load i32, i32* %4
%19 = icmp sle i32 %17, %18
br i1 %19, label %20, label %34
20: ; preds = %16
%21 = getelementptr inbounds [21 x i8], [21 x i8]* %5, i64 0, i64 0
%22 = call i64 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %21)
%23 = getelementptr inbounds [21 x i8], [21 x i8]* %5, i64 0, i64 0
%24 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %23)
%25 = load i32, i32* %3
%26 = srem i32 %25, 4
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %20
%29 = call i32 @putchar(i8 signext 10)
br label %30
30: ; preds = %28, %20
br label %31
31: ; preds = %30
%32 = load i32, i32* %3
%33 = add nsw i32 %32, 1
store i32 %33, i32* %3
br label %16
34: ; preds = %16
%35 = load i32, i32* %4
%36 = srem i32 %35, 4
%37 = icmp ne i32 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %34
%39 = call i32 @putchar(i8 signext 10)
br label %40
40: ; preds = %38, %34
%41 = call i32 @putchar(i8 signext 10)
br label %10
42: ; preds = %10
br label %6
43: ; preds = %6
ret i32 0
}

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