// File: /workspace/github_cpp_makefile_star2_O2/kdungs[P]codecon/src/matching.cc
// Function: main
int main() {
  auto k = 0u;
  std::cin >> k;
  if (k == 0) { return EXIT_FAILURE; }

  auto lines = std::vector<std::string>{};
  auto iit = std::istream_iterator<std::string>{std::cin};
  auto eit = std::istream_iterator<std::string>{};
  std::copy(iit, eit, std::back_inserter(lines));

  auto originalRows = std::vector<Row>(k);
  auto modifiedRows = std::vector<Row>(k);
  std::transform(std::begin(lines), std::begin(lines) + k,
                std::begin(originalRows), parseRow);
  std::transform(std::begin(lines) + k, std::end(lines),
                std::begin(modifiedRows), parseRow);

  const auto ps = matchingPositions(originalRows, modifiedRows);
  for (auto i = 0u; i < k; ++i) {
    std::cout << i << ',' << ps[i] << '\n';
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x130, %rsp            # imm = 0x130
leaq 0xc(%rsp), %rbx
andl $0x0, (%rbx)
movq 0x4945(%rip), %rdi      # 0x6fe0
movq %rbx, %rsi
callq 0x21b0
cmpl $0x0, (%rbx)
je 0x2857
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
andq $0x0, 0x20(%rsp)
movq 0x491f(%rip), %rsi      # 0x6fe0
leaq 0xd0(%rsp), %rdi
callq 0x2f04
leaq 0x108(%rsp), %rbx
andq $0x0, -0x8(%rbx)
leaq 0x118(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
xorl %ecx, %ecx
movb %cl, (%rax)
movb %cl, 0x10(%rax)
leaq 0xa0(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
callq 0x3024
leaq 0x70(%rsp), %rdi
leaq 0x100(%rsp), %rsi
callq 0x3024
leaq 0xa0(%rsp), %rdi
leaq 0x70(%rsp), %rsi
leaq 0x10(%rsp), %rdx
callq 0x2f44
leaq 0x78(%rsp), %rdi
callq 0x2070
leaq 0xa8(%rsp), %rdi
callq 0x2070
movl 0xc(%rsp), %esi
leaq 0x58(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0x3050
movl 0xc(%rsp), %esi
leaq 0x28(%rsp), %rdi
leaq 0x40(%rsp), %rdx
callq 0x3050
movq 0x10(%rsp), %rdi
movl 0xc(%rsp), %esi
shlq $0x5, %rsi
addq %rdi, %rsi
movq 0x58(%rsp), %rdx
leaq -0x38a(%rip), %rcx      # 0x2400
callq 0x30a1
movl 0xc(%rsp), %edi
shlq $0x5, %rdi
addq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq 0x28(%rsp), %rdx
leaq -0x3ad(%rip), %rcx      # 0x2400
callq 0x30a1
leaq 0x40(%rsp), %rdi
leaq 0x58(%rsp), %rsi
leaq 0x28(%rsp), %rdx
callq 0x24d7
xorl %r14d, %r14d
movq 0x4800(%rip), %r15      # 0x6fd0
pushq $0x2c
popq %rbp
pushq $0xa
popq %r12
movl 0xc(%rsp), %eax
cmpq %rax, %r14
jae 0x2816
movq %r15, %rdi
movq %r14, %rsi
callq 0x20b0
movq %rax, %rdi
movl %ebp, %esi
callq 0x2110
movq 0x40(%rsp), %rcx
movq (%rcx,%r14,8), %rsi
movq %rax, %rdi
callq 0x20b0
movq %rax, %rdi
movl %r12d, %esi
callq 0x2110
incq %r14
jmp 0x27d7
leaq 0x40(%rsp), %rdi
callq 0x33b2
leaq 0x28(%rsp), %rdi
callq 0x30fc
leaq 0x58(%rsp), %rdi
callq 0x30fc
movq %rbx, %rdi
callq 0x2070
leaq 0xd8(%rsp), %rdi
callq 0x2070
leaq 0x10(%rsp), %rdi
callq 0x311e
xorl %eax, %eax
jmp 0x285a
pushq $0x1
popq %rax
addq $0x130, %rsp            # imm = 0x130
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x286e
jmp 0x286e
movq %rax, %r14
jmp 0x28b2
movq %rax, %r14
jmp 0x28bc
jmp 0x289b
movq %rax, %r14
leaq 0x78(%rsp), %rdi
callq 0x2070
jmp 0x288c
movq %rax, %r14
leaq 0xa8(%rsp), %rdi
callq 0x2070
jmp 0x28c6
movq %rax, %r14
jmp 0x28c6
movq %rax, %r14
jmp 0x28db
movq %rax, %r14
leaq 0x40(%rsp), %rdi
callq 0x33b2
leaq 0x28(%rsp), %rdi
callq 0x30fc
leaq 0x58(%rsp), %rdi
callq 0x30fc
movq %rbx, %rdi
callq 0x2070
leaq 0xd8(%rsp), %rdi
callq 0x2070
leaq 0x10(%rsp), %rdi
callq 0x311e
movq %r14, %rdi
callq 0x21c0