#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 *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int i, j, k, N, t, an, i0, j0, col, x, y, flag, anx, any;
  int a[100][100];
  scanf("%d", &t);
  while (t--) {
    for (i = 1; i <= 19; i++) {
      for (j = 1; j <= 19; j++) {
        scanf("%d", &a[i][j]);
      }
    }
    for (i = 1; i <= 19; i++) {
      for (j = 1; j <= 19; j++) {
        if (a[i][j] != 0) {
          i0 = i;
          j0 = j;
          an = 0;
          col = a[i0][j0];
          for (y = j0; y <= 19; y++) {
            if (a[i0][y] == col)
              an++;
            else
              break;
          }
          if (an == 5) {
            anx = i0;
            any = j0;
            goto pp;
          } else
            an = 0;
          for (x = i0; x <= 19; x++) {
            if (a[x][j0] == col)
              an++;
            else
              break;
          }
          if (an == 5) {
            anx = i0;
            any = j0;
            goto pp;
          } else
            an = 0;
          for (x = i0, y = j0; x <= 19, y >= 1; x++, y--) {
            if (a[x][y] == col)
              an++;
            else
              break;
          }
          if (an == 5) {
            anx = x - 1;
            any = y + 1;
            goto pp;
          } else
            an = 0;
          for (x = i0, y = j0; x <= 19, y <= 19; x++, y++) {
            if (a[x][y] == col)
              an++;
            else
              break;
          }
          if (an == 5) {
            anx = i0;
            any = j0;
            goto pp;
          } else
            an = 0;
        }
      }
    }
    if (an == 0) {
      printf("0\n");
      continue;
    }
  pp:;
    printf("%d\n", col);
    printf("%d %d\n", anx, any);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x9c80,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec7(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x18(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x18(%rbp)
cmp    $0x0,%eax
je     14cb <main+0x3ab>
movl   $0x1,-0x8(%rbp)
cmpl   $0x13,-0x8(%rbp)
jg     11c5 <main+0xa5>
movl   $0x1,-0xc(%rbp)
cmpl   $0x13,-0xc(%rbp)
jg     11b2 <main+0x92>
movslq -0x8(%rbp),%rax
lea    -0x9c80(%rbp),%rsi
imul   $0x190,%rax,%rax
add    %rax,%rsi
movslq -0xc(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe61(%rip),%rdi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    116e <main+0x4e>
jmp    11b7 <main+0x97>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    115d <main+0x3d>
movl   $0x1,-0x8(%rbp)
cmpl   $0x13,-0x8(%rbp)
jg     147f <main+0x35f>
movl   $0x1,-0xc(%rbp)
cmpl   $0x13,-0xc(%rbp)
jg     146c <main+0x34c>
movslq -0x8(%rbp),%rcx
lea    -0x9c80(%rbp),%rax
imul   $0x190,%rcx,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
je     1459 <main+0x339>
mov    -0x8(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x24(%rbp)
movl   $0x0,-0x1c(%rbp)
movslq -0x20(%rbp),%rcx
lea    -0x9c80(%rbp),%rax
imul   $0x190,%rcx,%rcx
add    %rcx,%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x30(%rbp)
cmpl   $0x13,-0x30(%rbp)
jg     1297 <main+0x177>
movslq -0x20(%rbp),%rcx
lea    -0x9c80(%rbp),%rax
imul   $0x190,%rcx,%rcx
add    %rcx,%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x28(%rbp),%eax
jne    127f <main+0x15f>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1284 <main+0x164>
jmp    1297 <main+0x177>
jmp    1289 <main+0x169>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1242 <main+0x122>
cmpl   $0x5,-0x1c(%rbp)
jne    12b2 <main+0x192>
mov    -0x20(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x3c(%rbp)
jmp    14a1 <main+0x381>
movl   $0x0,-0x1c(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x2c(%rbp)
cmpl   $0x13,-0x2c(%rbp)
jg     1314 <main+0x1f4>
movslq -0x2c(%rbp),%rcx
lea    -0x9c80(%rbp),%rax
imul   $0x190,%rcx,%rcx
add    %rcx,%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x28(%rbp),%eax
jne    12fc <main+0x1dc>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1301 <main+0x1e1>
jmp    1314 <main+0x1f4>
jmp    1306 <main+0x1e6>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    12bf <main+0x19f>
cmpl   $0x5,-0x1c(%rbp)
jne    132f <main+0x20f>
mov    -0x20(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x3c(%rbp)
jmp    14a1 <main+0x381>
movl   $0x0,-0x1c(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x30(%rbp)
cmpl   $0x1,-0x30(%rbp)
jl     13a0 <main+0x280>
movslq -0x2c(%rbp),%rcx
lea    -0x9c80(%rbp),%rax
imul   $0x190,%rcx,%rcx
add    %rcx,%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x28(%rbp),%eax
jne    137f <main+0x25f>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1384 <main+0x264>
jmp    13a0 <main+0x280>
jmp    1389 <main+0x269>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x30(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x30(%rbp)
jmp    1342 <main+0x222>
cmpl   $0x5,-0x1c(%rbp)
jne    13c1 <main+0x2a1>
mov    -0x2c(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x38(%rbp)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    14a1 <main+0x381>
movl   $0x0,-0x1c(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x30(%rbp)
cmpl   $0x13,-0x30(%rbp)
jg     1432 <main+0x312>
movslq -0x2c(%rbp),%rcx
lea    -0x9c80(%rbp),%rax
imul   $0x190,%rcx,%rcx
add    %rcx,%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x28(%rbp),%eax
jne    1411 <main+0x2f1>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1416 <main+0x2f6>
jmp    1432 <main+0x312>
jmp    141b <main+0x2fb>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    13d4 <main+0x2b4>
cmpl   $0x5,-0x1c(%rbp)
jne    144d <main+0x32d>
mov    -0x20(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x3c(%rbp)
jmp    14a1 <main+0x381>
movl   $0x0,-0x1c(%rbp)
jmp    1459 <main+0x339>
jmp    145e <main+0x33e>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11dd <main+0xbd>
jmp    1471 <main+0x351>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11cc <main+0xac>
cmpl   $0x0,-0x1c(%rbp)
jne    149c <main+0x37c>
lea    0xb73(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1142 <main+0x22>
jmp    14a1 <main+0x381>
mov    -0x28(%rbp),%esi
lea    0xb5e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%esi
mov    -0x3c(%rbp),%edx
lea    0xb47(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1142 <main+0x22>
mov    -0x4(%rbp),%eax
add    $0x9c80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x9c88,%rsp
lea    0xeb8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
subl   $0x1,0x4(%rsp)
jae    116d <main+0x3d>
xor    %eax,%eax
add    $0x9c88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe8c(%rip),%rbx
jmp    11bb <main+0x8b>
cs nopw 0x0(%rax,%rax,1)
mov    $0x5,%r13d
mov    %r15d,%ebp
mov    %ecx,%r15d
lea    0xe73(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe5f(%rip),%rdi
mov    %ebp,0xc(%rsp)
mov    %ebp,%esi
mov    %r15d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
subl   $0x1,0x4(%rsp)
jb     1159 <main+0x29>
mov    %r14d,%ebp
mov    %r15d,0x10(%rsp)
mov    %ebp,%r14d
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
lea    (%rsp,%rbp,1),%rsi
add    $0x1d4,%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    (%rsp,%rbp,1),%rsi
add    $0x1d8,%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    (%rsp,%rbp,1),%rsi
add    $0x1dc,%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    (%rsp,%rbp,1),%rsi
add    $0x1e0,%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    (%rsp,%rbp,1),%rsi
add    $0x1e4,%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    (%rsp,%rbp,1),%rsi
add    $0x1e8,%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    (%rsp,%rbp,1),%rsi
add    $0x1ec,%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    (%rsp,%rbp,1),%rsi
add    $0x1f0,%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    (%rsp,%rbp,1),%rsi
add    $0x1f4,%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    (%rsp,%rbp,1),%rsi
add    $0x1f8,%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    (%rsp,%rbp,1),%rsi
add    $0x1fc,%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    (%rsp,%rbp,1),%rsi
add    $0x200,%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    (%rsp,%rbp,1),%rsi
add    $0x204,%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    (%rsp,%rbp,1),%rsi
add    $0x208,%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    (%rsp,%rbp,1),%rsi
add    $0x20c,%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    (%rsp,%rbp,1),%rsi
add    $0x210,%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    (%rsp,%rbp,1),%rsi
add    $0x214,%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    (%rsp,%rbp,1),%rsi
add    $0x218,%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    (%rsp,%rbp,1),%rsi
add    $0x21c,%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
add    $0x190,%rbp
cmp    $0x1db0,%rbp
jne    11d0 <main+0xa0>
mov    $0x1,%r15d
movl   $0x13,0x8(%rsp)
mov    $0x2,%r8d
mov    $0x12,%r12d
lea    0x368(%rsp),%r9
lea    0x1d0(%rsp),%rax
mov    %rax,0x18(%rsp)
lea    0x364(%rsp),%r10
lea    0x1d8(%rsp),%r11
mov    %r13d,%esi
mov    %r14d,%ebp
mov    $0x12,%edi
mov    %r9,0x30(%rsp)
mov    %r10,0x28(%rsp)
mov    %r11,0x20(%rsp)
mov    %r8d,0x14(%rsp)
mov    $0x13,%r13d
mov    $0x1,%ecx
mov    %r15,0x38(%rsp)
jmp    13e6 <main+0x2b6>
nopl   (%rax)
add    $0x1,%rcx
add    $0xffffffff,%r13d
add    $0x1,%r8d
add    $0xffffffffffffffff,%rdi
add    $0x4,%r11
add    $0x4,%r10
add    $0x4,%r9
cmp    $0x14,%rcx
je     1530 <main+0x400>
imul   $0x190,%r15,%rax
add    %rsp,%rax
add    $0x40,%rax
mov    (%rax,%rcx,4),%r14d
test   %r14d,%r14d
je     13c0 <main+0x290>
xor    %edx,%edx
nop
cmp    %edx,%edi
je     1420 <main+0x2f0>
lea    0x1(%rdx),%rax
cmp    %r14d,(%r11,%rdx,4)
mov    %rax,%rdx
je     1400 <main+0x2d0>
cmp    $0x5,%eax
jne    142c <main+0x2fc>
jmp    1180 <main+0x50>
nopl   0x0(%rax,%rax,1)
mov    %r13d,%eax
cmp    $0x5,%eax
je     1180 <main+0x50>
xor    %eax,%eax
mov    %r10,%rdx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmp    %eax,%r12d
je     1470 <main+0x340>
lea    0x190(%rdx),%rbp
add    $0x1,%eax
cmp    %r14d,(%rdx)
mov    %rbp,%rdx
je     1440 <main+0x310>
cmp    $0x5,%eax
jne    147d <main+0x34d>
jmp    1180 <main+0x50>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x8(%rsp),%eax
cmp    $0x5,%eax
je     1180 <main+0x50>
mov    0x18(%rsp),%rbp
xor    %edx,%edx
mov    %ecx,%eax
cs nopw 0x0(%rax,%rax,1)
mov    %eax,%esi
cmp    %r14d,0x0(%rbp,%rsi,4)
jne    14d0 <main+0x3a0>
add    $0xffffffff,%eax
add    $0xffffffffffffffff,%rdx
add    $0x190,%rbp
mov    %rcx,%rsi
add    %rdx,%rsi
jne    1490 <main+0x360>
xor    %r15d,%r15d
mov    %ecx,%edx
mov    %r8d,%ebp
cmp    $0x5,%edx
jne    14e4 <main+0x3b4>
jmp    15b0 <main+0x480>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r15d,%ebp
sub    %edx,%ebp
lea    (%rcx,%rdx,1),%r15d
neg    %edx
cmp    $0x5,%edx
je     15b0 <main+0x480>
mov    %r9,%rax
xor    %edx,%edx
mov    0x38(%rsp),%r15
xchg   %ax,%ax
cmp    %edx,%edi
je     1510 <main+0x3e0>
add    $0x1,%rdx
lea    0x194(%rax),%rsi
cmp    %r14d,(%rax)
mov    %rsi,%rax
je     14f0 <main+0x3c0>
jmp    1513 <main+0x3e3>
nopl   0x0(%rax)
mov    %r13d,%edx
xor    %esi,%esi
cmp    $0x5,%edx
je     1180 <main+0x50>
mov    %r14d,%ebp
jmp    13c0 <main+0x290>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%r15
addl   $0xffffffff,0x8(%rsp)
mov    0x14(%rsp),%r8d
add    $0x1,%r8d
mov    0x20(%rsp),%r11
add    $0x190,%r11
add    $0xffffffff,%r12d
mov    0x28(%rsp),%r10
add    $0x190,%r10
addq   $0x190,0x18(%rsp)
mov    0x30(%rsp),%r9
add    $0x190,%r9
cmp    $0x14,%r15
jne    1392 <main+0x262>
test   %esi,%esi
mov    0x10(%rsp),%r15d
jne    15c2 <main+0x492>
lea    0xa7d(%rip),%rdi
call   1030 <puts@plt>
xor    %r13d,%r13d
subl   $0x1,0x4(%rsp)
jae    11c3 <main+0x93>
jmp    1159 <main+0x29>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0xffffffff,%ebp
add    $0x1,%r15d
mov    $0x5,%r13d
jmp    118c <main+0x5c>
mov    %esi,%r13d
mov    %ebp,%r14d
mov    0xc(%rsp),%ebp
jmp    118c <main+0x5c>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"0\0A\00"
@.str.2 = [4 x i8] c"%d\0A\00"
@.str.3 = [7 x i8] c"%d %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca [100 x [100 x i32]]
store i32 0, i32* %1
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
br label %18
18: ; preds = %220, %217, %0
%19 = load i32, i32* %6
%20 = add nsw i32 %19, -1
store i32 %20, i32* %6
%21 = icmp ne i32 %19, 0
br i1 %21, label %22, label %226
22: ; preds = %18
store i32 1, i32* %2
br label %23
23: ; preds = %42, %22
%24 = load i32, i32* %2
%25 = icmp sle i32 %24, 19
br i1 %25, label %26, label %45
26: ; preds = %23
store i32 1, i32* %3
br label %27
27: ; preds = %38, %26
%28 = load i32, i32* %3
%29 = icmp sle i32 %28, 19
br i1 %29, label %30, label %41
30: ; preds = %27
%31 = load i32, i32* %2
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %16, i64 0, i64 %32
%34 = load i32, i32* %3
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [100 x i32], [100 x i32]* %33, i64 0, i64 %35
%37 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %36)
br label %38
38: ; preds = %30
%39 = load i32, i32* %3
%40 = add nsw i32 %39, 1
store i32 %40, i32* %3
br label %27
41: ; preds = %27
br label %42
42: ; preds = %41
%43 = load i32, i32* %2
%44 = add nsw i32 %43, 1
store i32 %44, i32* %2
br label %23
45: ; preds = %23
store i32 1, i32* %2
br label %46
46: ; preds = %211, %45
%47 = load i32, i32* %2
%48 = icmp sle i32 %47, 19
br i1 %48, label %49, label %214
49: ; preds = %46
store i32 1, i32* %3
br label %50
50: ; preds = %207, %49
%51 = load i32, i32* %3
%52 = icmp sle i32 %51, 19
br i1 %52, label %53, label %210
53: ; preds = %50
%54 = load i32, i32* %2
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %16, i64 0, i64 %55
%57 = load i32, i32* %3
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [100 x i32], [100 x i32]* %56, i64 0, i64 %58
%60 = load i32, i32* %59
%61 = icmp ne i32 %60, 0
br i1 %61, label %62, label %206
62: ; preds = %53
%63 = load i32, i32* %2
store i32 %63, i32* %8
%64 = load i32, i32* %3
store i32 %64, i32* %9
store i32 0, i32* %7
%65 = load i32, i32* %8
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %16, i64 0, i64 %66
%68 = load i32, i32* %9
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds [100 x i32], [100 x i32]* %67, i64 0, i64 %69
%71 = load i32, i32* %70
store i32 %71, i32* %10
%72 = load i32, i32* %9
store i32 %72, i32* %12
br label %73
73: ; preds = %91, %62
%74 = load i32, i32* %12
%75 = icmp sle i32 %74, 19
br i1 %75, label %76, label %94
76: ; preds = %73
%77 = load i32, i32* %8
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %16, i64 0, i64 %78
%80 = load i32, i32* %12
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds [100 x i32], [100 x i32]* %79, i64 0, i64 %81
%83 = load i32, i32* %82
%84 = load i32, i32* %10
%85 = icmp eq i32 %83, %84
br i1 %85, label %86, label %89
86: ; preds = %76
%87 = load i32, i32* %7
%88 = add nsw i32 %87, 1
store i32 %88, i32* %7
br label %90
89: ; preds = %76
br label %94
90: ; preds = %86
br label %91
91: ; preds = %90
%92 = load i32, i32* %12
%93 = add nsw i32 %92, 1
store i32 %93, i32* %12
br label %73
94: ; preds = %89, %73
%95 = load i32, i32* %7
%96 = icmp eq i32 %95, 5
br i1 %96, label %97, label %100
97: ; preds = %94
%98 = load i32, i32* %8
store i32 %98, i32* %14
%99 = load i32, i32* %9
store i32 %99, i32* %15
br label %220
100: ; preds = %94
store i32 0, i32* %7
br label %101
101: ; preds = %100
%102 = load i32, i32* %8
store i32 %102, i32* %11
br label %103
103: ; preds = %121, %101
%104 = load i32, i32* %11
%105 = icmp sle i32 %104, 19
br i1 %105, label %106, label %124
106: ; preds = %103
%107 = load i32, i32* %11
%108 = sext i32 %107 to i64
%109 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %16, i64 0, i64 %108
%110 = load i32, i32* %9
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds [100 x i32], [100 x i32]* %109, i64 0, i64 %111
%113 = load i32, i32* %112
%114 = load i32, i32* %10
%115 = icmp eq i32 %113, %114
br i1 %115, label %116, label %119
116: ; preds = %106
%117 = load i32, i32* %7
%118 = add nsw i32 %117, 1
store i32 %118, i32* %7
br label %120
119: ; preds = %106
br label %124
120: ; preds = %116
br label %121
121: ; preds = %120
%122 = load i32, i32* %11
%123 = add nsw i32 %122, 1
store i32 %123, i32* %11
br label %103
124: ; preds = %119, %103
%125 = load i32, i32* %7
%126 = icmp eq i32 %125, 5
br i1 %126, label %127, label %130
127: ; preds = %124
%128 = load i32, i32* %8
store i32 %128, i32* %14
%129 = load i32, i32* %9
store i32 %129, i32* %15
br label %220
130: ; preds = %124
store i32 0, i32* %7
br label %131
131: ; preds = %130
%132 = load i32, i32* %8
store i32 %132, i32* %11
%133 = load i32, i32* %9
store i32 %133, i32* %12
br label %134
134: ; preds = %155, %131
%135 = load i32, i32* %11
%136 = icmp sle i32 %135, 19
%137 = zext i1 %136 to i32
%138 = load i32, i32* %12
%139 = icmp sge i32 %138, 1
br i1 %139, label %140, label %160
140: ; preds = %134
%141 = load i32, i32* %11
%142 = sext i32 %141 to i64
%143 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %16, i64 0, i64 %142
%144 = load i32, i32* %12
%145 = sext i32 %144 to i64
%146 = getelementptr inbounds [100 x i32], [100 x i32]* %143, i64 0, i64 %145
%147 = load i32, i32* %146
%148 = load i32, i32* %10
%149 = icmp eq i32 %147, %148
br i1 %149, label %150, label %153
150: ; preds = %140
%151 = load i32, i32* %7
%152 = add nsw i32 %151, 1
store i32 %152, i32* %7
br label %154
153: ; preds = %140
br label %160
154: ; preds = %150
br label %155
155: ; preds = %154
%156 = load i32, i32* %11
%157 = add nsw i32 %156, 1
store i32 %157, i32* %11
%158 = load i32, i32* %12
%159 = add nsw i32 %158, -1
store i32 %159, i32* %12
br label %134
160: ; preds = %153, %134
%161 = load i32, i32* %7
%162 = icmp eq i32 %161, 5
br i1 %162, label %163, label %168
163: ; preds = %160
%164 = load i32, i32* %11
%165 = sub nsw i32 %164, 1
store i32 %165, i32* %14
%166 = load i32, i32* %12
%167 = add nsw i32 %166, 1
store i32 %167, i32* %15
br label %220
168: ; preds = %160
store i32 0, i32* %7
br label %169
169: ; preds = %168
%170 = load i32, i32* %8
store i32 %170, i32* %11
%171 = load i32, i32* %9
store i32 %171, i32* %12
br label %172
172: ; preds = %193, %169
%173 = load i32, i32* %11
%174 = icmp sle i32 %173, 19
%175 = zext i1 %174 to i32
%176 = load i32, i32* %12
%177 = icmp sle i32 %176, 19
br i1 %177, label %178, label %198
178: ; preds = %172
%179 = load i32, i32* %11
%180 = sext i32 %179 to i64
%181 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %16, i64 0, i64 %180
%182 = load i32, i32* %12
%183 = sext i32 %182 to i64
%184 = getelementptr inbounds [100 x i32], [100 x i32]* %181, i64 0, i64 %183
%185 = load i32, i32* %184
%186 = load i32, i32* %10
%187 = icmp eq i32 %185, %186
br i1 %187, label %188, label %191
188: ; preds = %178
%189 = load i32, i32* %7
%190 = add nsw i32 %189, 1
store i32 %190, i32* %7
br label %192
191: ; preds = %178
br label %198
192: ; preds = %188
br label %193
193: ; preds = %192
%194 = load i32, i32* %11
%195 = add nsw i32 %194, 1
store i32 %195, i32* %11
%196 = load i32, i32* %12
%197 = add nsw i32 %196, 1
store i32 %197, i32* %12
br label %172
198: ; preds = %191, %172
%199 = load i32, i32* %7
%200 = icmp eq i32 %199, 5
br i1 %200, label %201, label %204
201: ; preds = %198
%202 = load i32, i32* %8
store i32 %202, i32* %14
%203 = load i32, i32* %9
store i32 %203, i32* %15
br label %220
204: ; preds = %198
store i32 0, i32* %7
br label %205
205: ; preds = %204
br label %206
206: ; preds = %205, %53
br label %207
207: ; preds = %206
%208 = load i32, i32* %3
%209 = add nsw i32 %208, 1
store i32 %209, i32* %3
br label %50
210: ; preds = %50
br label %211
211: ; preds = %210
%212 = load i32, i32* %2
%213 = add nsw i32 %212, 1
store i32 %213, i32* %2
br label %46
214: ; preds = %46
%215 = load i32, i32* %7
%216 = icmp eq i32 %215, 0
br i1 %216, label %217, label %219
217: ; preds = %214
%218 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %18
219: ; preds = %214
br label %220
220: ; preds = %219, %201, %163, %127, %97
%221 = load i32, i32* %10
%222 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %221)
%223 = load i32, i32* %14
%224 = load i32, i32* %15
%225 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %223, i32 %224)
br label %18
226: ; preds = %18
%227 = load i32, i32* %1
ret i32 %227
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"%d\0A\00"
@.str.3 = [7 x i8] c"%d %d\0A\00"
@str = [2 x i8] c"0\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x [100 x i32]]
%3 = bitcast i32* %1 to i8*
%4 = bitcast [100 x [100 x i32]]* %2 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 = add nsw i32 %6, -1
store i32 %7, i32* %1
%8 = icmp eq i32 %6, 0
br i1 %8, label %172, label %9
9: ; preds = %0, %162
%10 = phi i32 [ %166, %162 ], [ undef, %0 ]
%11 = phi i32 [ %165, %162 ], [ undef, %0 ]
%12 = phi i32 [ %164, %162 ], [ undef, %0 ]
%13 = phi i32 [ %163, %162 ], [ undef, %0 ]
br label %14
14: ; preds = %9, %154
%15 = phi i32 [ %12, %9 ], [ %142, %154 ]
%16 = phi i32 [ %13, %9 ], [ 0, %154 ]
br label %17
17: ; preds = %14, %17
%18 = phi i64 [ 1, %14 ], [ %57, %17 ]
%19 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %2, i64 0, i64 %18, i64 1
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %19)
%21 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %2, i64 0, i64 %18, i64 2
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %21)
%23 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %2, i64 0, i64 %18, i64 3
%24 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %23)
%25 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %2, i64 0, i64 %18, i64 4
%26 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %25)
%27 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %2, i64 0, i64 %18, i64 5
%28 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %27)
%29 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %2, i64 0, i64 %18, i64 6
%30 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %29)
%31 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %2, i64 0, i64 %18, i64 7
%32 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %31)
%33 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %2, i64 0, i64 %18, i64 8
%34 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %33)
%35 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %2, i64 0, i64 %18, i64 9
%36 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %35)
%37 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %2, i64 0, i64 %18, i64 10
%38 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %37)
%39 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %2, i64 0, i64 %18, i64 11
%40 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %39)
%41 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %2, i64 0, i64 %18, i64 12
%42 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %41)
%43 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %2, i64 0, i64 %18, i64 13
%44 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %43)
%45 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %2, i64 0, i64 %18, i64 14
%46 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %45)
%47 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %2, i64 0, i64 %18, i64 15
%48 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %47)
%49 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %2, i64 0, i64 %18, i64 16
%50 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %49)
%51 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %2, i64 0, i64 %18, i64 17
%52 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %51)
%53 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %2, i64 0, i64 %18, i64 18
%54 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %53)
%55 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %2, i64 0, i64 %18, i64 19
%56 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %55)
%57 = add nuw nsw i64 %18, 1
%58 = icmp eq i64 %57, 20
br i1 %58, label %59, label %17
59: ; preds = %17, %147
%60 = phi i32 [ %150, %147 ], [ 2, %17 ]
%61 = phi i32 [ %149, %147 ], [ 19, %17 ]
%62 = phi i64 [ %148, %147 ], [ 1, %17 ]
%63 = phi i32 [ %142, %147 ], [ %15, %17 ]
%64 = phi i32 [ %141, %147 ], [ %16, %17 ]
br label %65
65: ; preds = %59, %140
%66 = phi i32 [ %60, %59 ], [ %145, %140 ]
%67 = phi i32 [ 19, %59 ], [ %144, %140 ]
%68 = phi i64 [ 1, %59 ], [ %143, %140 ]
%69 = phi i32 [ %63, %59 ], [ %142, %140 ]
%70 = phi i32 [ %64, %59 ], [ %141, %140 ]
%71 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %2, i64 0, i64 %62, i64 %68
%72 = load i32, i32* %71
%73 = icmp eq i32 %72, 0
br i1 %73, label %140, label %74
74: ; preds = %65, %80
%75 = phi i32 [ %77, %80 ], [ 0, %65 ]
%76 = phi i64 [ %78, %80 ], [ %68, %65 ]
%77 = add nuw nsw i32 %75, 1
%78 = add nuw nsw i64 %76, 1
%79 = icmp eq i32 %77, %67
br i1 %79, label %84, label %80
80: ; preds = %74
%81 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %2, i64 0, i64 %62, i64 %78
%82 = load i32, i32* %81
%83 = icmp eq i32 %82, %72
br i1 %83, label %74, label %84
84: ; preds = %74, %80
%85 = phi i32 [ %67, %74 ], [ %77, %80 ]
%86 = icmp eq i32 %85, 5
%87 = trunc i64 %68 to i32
br i1 %86, label %159, label %88
88: ; preds = %84, %94
%89 = phi i32 [ %91, %94 ], [ 0, %84 ]
%90 = phi i64 [ %92, %94 ], [ %62, %84 ]
%91 = add nuw nsw i32 %89, 1
%92 = add nuw nsw i64 %90, 1
%93 = icmp eq i32 %91, %61
br i1 %93, label %98, label %94
94: ; preds = %88
%95 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %2, i64 0, i64 %92, i64 %68
%96 = load i32, i32* %95
%97 = icmp eq i32 %96, %72
br i1 %97, label %88, label %98
98: ; preds = %88, %94
%99 = phi i32 [ %61, %88 ], [ %91, %94 ]
%100 = icmp eq i32 %99, 5
br i1 %100, label %159, label %101
101: ; preds = %98, %109
%102 = phi i64 [ %111, %109 ], [ %62, %98 ]
%103 = phi i32 [ %112, %109 ], [ %87, %98 ]
%104 = phi i32 [ %110, %109 ], [ 0, %98 ]
%105 = zext i32 %103 to i64
%106 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %2, i64 0, i64 %102, i64 %105
%107 = load i32, i32* %106
%108 = icmp eq i32 %107, %72
br i1 %108, label %109, label %115
109: ; preds = %101
%110 = add nuw nsw i32 %104, 1
%111 = add nuw nsw i64 %102, 1
%112 = add nsw i32 %103, -1
%113 = zext i32 %110 to i64
%114 = icmp eq i64 %68, %113
br i1 %114, label %117, label %101
115: ; preds = %101
%116 = trunc i64 %102 to i32
br label %117
117: ; preds = %109, %115
%118 = phi i32 [ %104, %115 ], [ %87, %109 ]
%119 = phi i32 [ %116, %115 ], [ %66, %109 ]
%120 = phi i32 [ %103, %115 ], [ 0, %109 ]
%121 = icmp eq i32 %118, 5
br i1 %121, label %122, label %125
122: ; preds = %117
%123 = add nsw i32 %119, -1
%124 = add nsw i32 %120, 1
br label %162
125: ; preds = %117, %133
%126 = phi i32 [ %129, %133 ], [ 0, %117 ]
%127 = phi i64 [ %131, %133 ], [ %68, %117 ]
%128 = phi i64 [ %130, %133 ], [ %62, %117 ]
%129 = add nuw nsw i32 %126, 1
%130 = add nuw nsw i64 %128, 1
%131 = add nuw nsw i64 %127, 1
%132 = icmp eq i32 %129, %67
br i1 %132, label %137, label %133
133: ; preds = %125
%134 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %2, i64 0, i64 %130, i64 %131
%135 = load i32, i32* %134
%136 = icmp eq i32 %135, %72
br i1 %136, label %125, label %137
137: ; preds = %125, %133
%138 = phi i32 [ %67, %125 ], [ %129, %133 ]
%139 = icmp eq i32 %138, 5
br i1 %139, label %159, label %140
140: ; preds = %137, %65
%141 = phi i32 [ %70, %65 ], [ 0, %137 ]
%142 = phi i32 [ %69, %65 ], [ %72, %137 ]
%143 = add nuw nsw i64 %68, 1
%144 = add nsw i32 %67, -1
%145 = add nuw nsw i32 %66, 1
%146 = icmp eq i64 %143, 20
br i1 %146, label %147, label %65
147: ; preds = %140
%148 = add nuw nsw i64 %62, 1
%149 = add nsw i32 %61, -1
%150 = add nuw nsw i32 %60, 1
%151 = icmp eq i64 %148, 20
br i1 %151, label %152, label %59
152: ; preds = %147
%153 = icmp eq i32 %141, 0
br i1 %153, label %154, label %162
154: ; preds = %152
%155 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%156 = load i32, i32* %1
%157 = add nsw i32 %156, -1
store i32 %157, i32* %1
%158 = icmp eq i32 %156, 0
br i1 %158, label %172, label %14
159: ; preds = %84, %98, %137
%160 = trunc i64 %62 to i32
%161 = trunc i64 %68 to i32
br label %162
162: ; preds = %152, %159, %122
%163 = phi i32 [ 5, %122 ], [ 5, %159 ], [ %141, %152 ]
%164 = phi i32 [ %72, %122 ], [ %72, %159 ], [ %142, %152 ]
%165 = phi i32 [ %123, %122 ], [ %160, %159 ], [ %11, %152 ]
%166 = phi i32 [ %124, %122 ], [ %161, %159 ], [ %10, %152 ]
%167 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %164)
%168 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %165, i32 %166)
%169 = load i32, i32* %1
%170 = add nsw i32 %169, -1
store i32 %170, i32* %1
%171 = icmp eq i32 %169, 0
br i1 %171, label %172, label %9
172: ; preds = %162, %154, %0
ret i32 0
}