// File: /workspace/github_cpp_makefile_star2_O2/kdungs[P]codecon/src/golf.cc
// Function: main
int main() {
  const auto map = std::vector<std::vector<unsigned>>{{4, 6},
                                                      {6, 8},
                                                      {7, 9},
                                                      {4, 8},
                                                      {0, 3, 9},
                                                      {},
                                                      {0, 1, 7},
                                                      {2, 6},
                                                      {1, 3},
                                                      {2, 4}};

  auto steps = 0u;
  std::cin >> steps;

  std::cout << solve(map, 9u, 1u, steps) << '\n';
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x168, %rsp            # imm = 0x168
movabsq $0x600000004, %rax      # imm = 0x600000004
leaq 0x58(%rsp), %rsi
movq %rax, (%rsi)
leaq 0x78(%rsp), %rbx
pushq $0x2
popq %rdx
leaq 0xf(%rsp), %rcx
movq %rbx, %rdi
callq 0x1564
leaq 0x90(%rsp), %r14
movabsq $0x800000006, %rax      # imm = 0x800000006
leaq 0x50(%rsp), %rsi
movq %rax, (%rsi)
pushq $0x2
popq %rdx
leaq 0xe(%rsp), %rcx
movq %r14, %rdi
callq 0x1564
leaq 0xa8(%rsp), %r14
movabsq $0x900000007, %rax      # imm = 0x900000007
leaq 0x48(%rsp), %rsi
movq %rax, (%rsi)
pushq $0x2
popq %rdx
leaq 0xd(%rsp), %rcx
movq %r14, %rdi
callq 0x1564
leaq 0xc0(%rsp), %r14
movabsq $0x800000004, %rax      # imm = 0x800000004
leaq 0x40(%rsp), %rsi
movq %rax, (%rsi)
pushq $0x2
popq %rdx
leaq 0xc(%rsp), %rcx
movq %r14, %rdi
callq 0x1564
leaq 0xd8(%rsp), %r14
movabsq $0x300000000, %rax      # imm = 0x300000000
leaq 0x6c(%rsp), %rsi
movq %rax, (%rsi)
movl $0x9, 0x8(%rsi)
pushq $0x3
popq %rdx
leaq 0xb(%rsp), %rcx
movq %r14, %rdi
callq 0x1564
leaq 0x108(%rsp), %r14
xorps %xmm0, %xmm0
movups %xmm0, -0x18(%r14)
andq $0x0, -0x8(%r14)
movabsq $0x100000000, %rax      # imm = 0x100000000
leaq 0x60(%rsp), %rsi
movq %rax, (%rsi)
movl $0x7, 0x8(%rsi)
pushq $0x3
popq %rdx
leaq 0xa(%rsp), %rcx
movq %r14, %rdi
callq 0x1564
leaq 0x120(%rsp), %r14
movabsq $0x600000002, %rax      # imm = 0x600000002
leaq 0x38(%rsp), %rsi
movq %rax, (%rsi)
pushq $0x2
popq %rdx
leaq 0x9(%rsp), %rcx
movq %r14, %rdi
callq 0x1564
leaq 0x138(%rsp), %r14
movabsq $0x300000001, %rax      # imm = 0x300000001
leaq 0x30(%rsp), %rsi
movq %rax, (%rsi)
pushq $0x2
popq %rdx
leaq 0x8(%rsp), %rcx
movq %r14, %rdi
callq 0x1564
leaq 0x150(%rsp), %r14
movabsq $0x400000002, %rax      # imm = 0x400000002
leaq 0x28(%rsp), %rsi
movq %rax, (%rsi)
pushq $0x2
popq %rdx
leaq 0x7(%rsp), %rcx
movq %r14, %rdi
callq 0x1564
leaq 0x10(%rsp), %rdi
leaq 0x78(%rsp), %rsi
pushq $0xa
popq %rdx
leaq 0x6(%rsp), %rcx
callq 0x159a
movl $0xd8, %ebx
leaq (%rsp,%rbx), %rdi
addq $0x78, %rdi
callq 0x1600
addq $-0x18, %rbx
cmpq $-0x18, %rbx
jne 0x147e
leaq 0x78(%rsp), %rsi
andl $0x0, (%rsi)
movq 0x2b3c(%rip), %rdi      # 0x3fe0
callq 0x1110
movl 0x78(%rsp), %ecx
leaq 0x10(%rsp), %rdi
pushq $0x9
popq %rsi
pushq $0x1
popq %rdx
callq 0x125c
movl %eax, %esi
movq 0x2b0a(%rip), %rdi      # 0x3fd0
callq 0x1070
pushq $0xa
popq %rsi
movq %rax, %rdi
callq 0x10c0
leaq 0x10(%rsp), %rdi
callq 0x15d4
xorl %eax, %eax
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %r15
movl $0xd8, %r12d
leaq (%rsp,%r12), %rdi
addq $0x78, %rdi
callq 0x1600
addq $-0x18, %r12
cmpq $-0x18, %r12
jne 0x14fa
movb $0x1, %al
jmp 0x1528
jmp 0x1523
jmp 0x1523
jmp 0x1523
jmp 0x1523
jmp 0x1523
jmp 0x1523
jmp 0x1523
movq %rax, %r15
xorl %eax, %eax
cmpq %r14, %rbx
sete %cl
testb %al, %al
jne 0x155b
testb %cl, %cl
jne 0x155b
addq $-0x18, %r14
movq %r14, %rdi
callq 0x1600
cmpq %rbx, %r14
jne 0x1536
jmp 0x155b
movq %rax, %r15
jmp 0x155b
movq %rax, %r15
leaq 0x10(%rsp), %rdi
callq 0x15d4
movq %r15, %rdi
callq 0x1120
nop