#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, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int i, n;
  scanf("%d", &n);
  printf("%d %d %d\n", 1, 1, n);
  for (i = 1; i <= n; i++) {
    printf("%d %d %d\n", 1, i % 2 ? (i + 1) / 2 : n - (i - 1) / 2, i);
    if (i == n / 2)
      printf("%d %d\n", 6, n);
  }
  printf("%d %d\n", 4, 1);
  for (i = 1; i <= n; i++) {
    printf("%d \n", 2);
  }
  printf("\n %d \n", 8);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%ecx
lea    0xeba(%rip),%rdi
mov    $0x1,%edx
mov    %edx,%esi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1212 <main+0xf2>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1194 <main+0x74>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
jmp    11b2 <main+0x92>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edx
mov    -0x8(%rbp),%ecx
lea    0xe44(%rip),%rdi
mov    $0x1,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
cmp    %ecx,%eax
jne    11ff <main+0xdf>
mov    -0xc(%rbp),%edx
lea    0xe13(%rip),%rdi
mov    $0x6,%esi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1204 <main+0xe4>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    115e <main+0x3e>
lea    0xded(%rip),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     125e <main+0x13e>
lea    0xdcb(%rip),%rdi
mov    $0x2,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1231 <main+0x111>
lea    0xda8(%rip),%rdi
mov    $0x8,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%ecx
lea    0xebf(%rip),%rdi
mov    $0x1,%esi
mov    $0x1,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0xc(%rsp),%edx
test   %edx,%edx
jle    11ce <main+0xae>
lea    0xe9f(%rip),%rbx
lea    0xe9b(%rip),%r14
xor    %eax,%eax
jmp    1176 <main+0x56>
nop
mov    %ebp,%eax
cmp    %edx,%ebp
jge    11ce <main+0xae>
lea    0x1(%rax),%ebp
test   $0x1,%bpl
jne    1190 <main+0x70>
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
sub    %ecx,%edx
mov    %edx,%eax
jmp    1195 <main+0x75>
xchg   %ax,%ax
add    $0x2,%eax
shr    %eax
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %eax,%edx
mov    %ebp,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0xc(%rsp),%edx
mov    %edx,%eax
shr    $0x1f,%eax
add    %edx,%eax
sar    %eax
cmp    %eax,%ebp
jne    1170 <main+0x50>
mov    %r14,%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0xc(%rsp),%edx
jmp    1170 <main+0x50>
lea    0xe31(%rip),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x0,0xc(%rsp)
jle    1218 <main+0xf8>
lea    0xe1b(%rip),%rbx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%ebp
cmp    0xc(%rsp),%ebp
jl     1200 <main+0xe0>
lea    0xdee(%rip),%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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