#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*/ puts(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, const char *argv[]) {
  int a;
  scanf("%i", &a);
  switch (a) {
  case 1:
    puts("1");
    break;
  case 2:
    puts("1 2\n"
         "3 4");
    break;
  case 3:
    puts("1 2 6\n"
         "3 5 7\n"
         "4 8 9");
    break;
  case 4:
    puts("1 2 6 7\n"
         "3 5 8 13\n"
         "4 9 12 14\n"
         "10 11 15 16");
    break;
  case 5:
    puts("1 2 6 7 15\n"
         "3 5 8 14 16\n"
         "4 9 13 17 22\n"
         "10 12 18 21 23\n"
         "11 19 20 24 25");
    break;
  case 6:
    puts("1 2 6 7 15 16\n"
         "3 5 8 14 17 26\n"
         "4 9 13 18 25 27\n"
         "10 12 19 24 28 33\n"
         "11 20 23 29 32 34\n"
         "21 22 30 31 35 36");
    break;
  case 7:
    puts("1 2 6 7 15 16 28\n"
         "3 5 8 14 17 27 29\n"
         "4 9 13 18 26 30 39\n"
         "10 12 19 25 31 38 40\n"
         "11 20 24 32 37 41 46\n"
         "21 23 33 36 42 45 47\n"
         "22 34 35 43 44 48 49");
    break;
  case 8:
    puts("1 2 6 7 15 16 28 29\n"
         "3 5 8 14 17 27 30 43\n"
         "4 9 13 18 26 31 42 44\n"
         "10 12 19 25 32 41 45 54\n"
         "11 20 24 33 40 46 53 55\n"
         "21 23 34 39 47 52 56 61\n"
         "22 35 38 48 51 57 60 62\n"
         "36 37 49 50 58 59 63 64");
    break;
  case 9:
    puts("1 2 6 7 15 16 28 29 45\n"
         "3 5 8 14 17 27 30 44 46\n"
         "4 9 13 18 26 31 43 47 60\n"
         "10 12 19 25 32 42 48 59 61\n"
         "11 20 24 33 41 49 58 62 71\n"
         "21 23 34 40 50 57 63 70 72\n"
         "22 35 39 51 56 64 69 73 78\n"
         "36 38 52 55 65 68 74 77 79\n"
         "37 53 54 66 67 75 76 80 81");
    break;
  case 10:
    puts("1 2 6 7 15 16 28 29 45 46\n"
         "3 5 8 14 17 27 30 44 47 64\n"
         "4 9 13 18 26 31 43 48 63 65\n"
         "10 12 19 25 32 42 49 62 66 79\n"
         "11 20 24 33 41 50 61 67 78 80\n"
         "21 23 34 40 51 60 68 77 81 90\n"
         "22 35 39 52 59 69 76 82 89 91\n"
         "36 38 53 58 70 75 83 88 92 97\n"
         "37 54 57 71 74 84 87 93 96 98\n"
         "55 56 72 73 85 86 94 95 99 100");
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeeb(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x9,%eax
ja     1214 <main+0xf4>
mov    -0x20(%rbp),%rax
lea    0xe9a(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0x11c4(%rip),%rdi
call   1030 <puts@plt>
jmp    1214 <main+0xf4>
lea    0xea4(%rip),%rdi
call   1030 <puts@plt>
jmp    1214 <main+0xf4>
lea    0xe9b(%rip),%rdi
call   1030 <puts@plt>
jmp    1214 <main+0xf4>
lea    0xe9c(%rip),%rdi
call   1030 <puts@plt>
jmp    1214 <main+0xf4>
lea    0xeb2(%rip),%rdi
call   1030 <puts@plt>
jmp    1214 <main+0xf4>
lea    0xee3(%rip),%rdi
call   1030 <puts@plt>
jmp    1214 <main+0xf4>
lea    0xf35(%rip),%rdi
call   1030 <puts@plt>
jmp    1214 <main+0xf4>
lea    0xfae(%rip),%rdi
call   1030 <puts@plt>
jmp    1214 <main+0xf4>
lea    0x1054(%rip),%rdi
call   1030 <puts@plt>
jmp    1214 <main+0xf4>
lea    0x112d(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x9,%eax
ja     1153 <main+0x33>
cltq
lea    0x12f1(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%i\00"
@.str.1 = [2 x i8] c"1\00"
@.str.2 = [8 x i8] c"1 2\0A3 4\00"
@.str.3 = [18 x i8] c"1 2 6\0A3 5 7\0A4 8 9\00"
@.str.4 = [39 x i8] c"1 2 6 7\0A3 5 8 13\0A4 9 12 14\0A10 11 15 16\00"
@.str.5 = [66 x i8] c"1 2 6 7 15\0A3 5 8 14 16\0A4 9 13 17 22\0A10 12 18 21 23\0A11 19 20 24 25\00"
@.str.6 = [99 x i8] c"1 2 6 7 15 16\0A3 5 8 14 17 26\0A4 9 13 18 25 27\0A10 12 19 24 28 33\0A11 20 23 29 32 34\0A21 22 30 31 35 36\00"
@.str.7 = [138 x i8] c"1 2 6 7 15 16 28\0A3 5 8 14 17 27 29\0A4 9 13 18 26 30 39\0A10 12 19 25 31 38 40\0A11 20 24 32 37 41 46\0A21 23 33 36 42 45 47\0A22 34 35 43 44 48 49\00"
@.str.8 = [183 x i8] c"1 2 6 7 15 16 28 29\0A3 5 8 14 17 27 30 43\0A4 9 13 18 26 31 42 44\0A10 12 19 25 32 41 45 54\0A11 20 24 33 40 46 53 55\0A21 23 34 39 47 52 56 61\0A22 35 38 48 51 57 60 62\0A36 37 49 50 58 59 63 64\00"
@.str.9 = [234 x i8] c"1 2 6 7 15 16 28 29 45\0A3 5 8 14 17 27 30 44 46\0A4 9 13 18 26 31 43 47 60\0A10 12 19 25 32 42 48 59 61\0A11 20 24 33 41 49 58 62 71\0A21 23 34 40 50 57 63 70 72\0A22 35 39 51 56 64 69 73 78\0A36 38 52 55 65 68 74 77 79\0A37 53 54 66 67 75 76 80 81\00"
@.str.10 = [292 x i8] c"1 2 6 7 15 16 28 29 45 46\0A3 5 8 14 17 27 30 44 47 64\0A4 9 13 18 26 31 43 48 63 65\0A10 12 19 25 32 42 49 62 66 79\0A11 20 24 33 41 50 61 67 78 80\0A21 23 34 40 51 60 68 77 81 90\0A22 35 39 52 59 69 76 82 89 91\0A36 38 53 58 70 75 83 88 92 97\0A37 54 57 71 74 84 87 93 96 98\0A55 56 72 73 85 86 94 95 99 100\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%8 = load i32, i32* %6
switch i32 %8, label %29 [
i32 1, label %9
i32 2, label %11
i32 3, label %13
i32 4, label %15
i32 5, label %17
i32 6, label %19
i32 7, label %21
i32 8, label %23
i32 9, label %25
i32 10, label %27
]
9: ; preds = %2
%10 = call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %29
11: ; preds = %2
%12 = call i32 @puts(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %29
13: ; preds = %2
%14 = call i32 @puts(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
br label %29
15: ; preds = %2
%16 = call i32 @puts(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0))
br label %29
17: ; preds = %2
%18 = call i32 @puts(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.5, i64 0, i64 0))
br label %29
19: ; preds = %2
%20 = call i32 @puts(i8* getelementptr inbounds ([99 x i8], [99 x i8]* @.str.6, i64 0, i64 0))
br label %29
21: ; preds = %2
%22 = call i32 @puts(i8* getelementptr inbounds ([138 x i8], [138 x i8]* @.str.7, i64 0, i64 0))
br label %29
23: ; preds = %2
%24 = call i32 @puts(i8* getelementptr inbounds ([183 x i8], [183 x i8]* @.str.8, i64 0, i64 0))
br label %29
25: ; preds = %2
%26 = call i32 @puts(i8* getelementptr inbounds ([234 x i8], [234 x i8]* @.str.9, i64 0, i64 0))
br label %29
27: ; preds = %2
%28 = call i32 @puts(i8* getelementptr inbounds ([292 x i8], [292 x i8]* @.str.10, i64 0, i64 0))
br label %29
29: ; preds = %2, %27, %25, %23, %21, %19, %17, %15, %13, %11, %9
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%i\00"
@.str.1 = [2 x i8] c"1\00"
@.str.2 = [8 x i8] c"1 2\0A3 4\00"
@.str.3 = [18 x i8] c"1 2 6\0A3 5 7\0A4 8 9\00"
@.str.4 = [39 x i8] c"1 2 6 7\0A3 5 8 13\0A4 9 12 14\0A10 11 15 16\00"
@.str.5 = [66 x i8] c"1 2 6 7 15\0A3 5 8 14 16\0A4 9 13 17 22\0A10 12 18 21 23\0A11 19 20 24 25\00"
@.str.6 = [99 x i8] c"1 2 6 7 15 16\0A3 5 8 14 17 26\0A4 9 13 18 25 27\0A10 12 19 24 28 33\0A11 20 23 29 32 34\0A21 22 30 31 35 36\00"
@.str.7 = [138 x i8] c"1 2 6 7 15 16 28\0A3 5 8 14 17 27 29\0A4 9 13 18 26 30 39\0A10 12 19 25 31 38 40\0A11 20 24 32 37 41 46\0A21 23 33 36 42 45 47\0A22 34 35 43 44 48 49\00"
@.str.8 = [183 x i8] c"1 2 6 7 15 16 28 29\0A3 5 8 14 17 27 30 43\0A4 9 13 18 26 31 42 44\0A10 12 19 25 32 41 45 54\0A11 20 24 33 40 46 53 55\0A21 23 34 39 47 52 56 61\0A22 35 38 48 51 57 60 62\0A36 37 49 50 58 59 63 64\00"
@.str.9 = [234 x i8] c"1 2 6 7 15 16 28 29 45\0A3 5 8 14 17 27 30 44 46\0A4 9 13 18 26 31 43 47 60\0A10 12 19 25 32 42 48 59 61\0A11 20 24 33 41 49 58 62 71\0A21 23 34 40 50 57 63 70 72\0A22 35 39 51 56 64 69 73 78\0A36 38 52 55 65 68 74 77 79\0A37 53 54 66 67 75 76 80 81\00"
@.str.10 = [292 x i8] c"1 2 6 7 15 16 28 29 45 46\0A3 5 8 14 17 27 30 44 47 64\0A4 9 13 18 26 31 43 48 63 65\0A10 12 19 25 32 42 49 62 66 79\0A11 20 24 33 41 50 61 67 78 80\0A21 23 34 40 51 60 68 77 81 90\0A22 35 39 52 59 69 76 82 89 91\0A36 38 53 58 70 75 83 88 92 97\0A37 54 57 71 74 84 87 93 96 98\0A55 56 72 73 85 86 94 95 99 100\00"
@reltable.main = [10 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.1 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.2 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([18 x i8]* @.str.3 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([39 x i8]* @.str.4 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([66 x i8]* @.str.5 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([99 x i8]* @.str.6 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([138 x i8]* @.str.7 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([183 x i8]* @.str.8 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([234 x i8]* @.str.9 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([292 x i8]* @.str.10 to i64), i64 ptrtoint ([10 x i32]* @reltable.main to i64)) to i32)]
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%6 = load i32, i32* %3
%7 = add i32 %6, -1
%8 = icmp ult i32 %7, 10
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = sext i32 %7 to i64
%11 = shl i64 %10, 2
%12 = call i8* @llvm.load.relative.i64(i8* bitcast ([10 x i32]* @reltable.main to i8*), i64 %11)
%13 = call i32 @puts(i8* dereferenceable(1) %12)
br label %14
14: ; preds = %2, %9
ret i32 0
}