// File: /workspace/github_cpp_makefile_star2_O1/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 %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
leaq 0xc(%rsp), %rbx
movl $0x0, (%rbx)
movq 0x4756(%rip), %rdi      # 0x6fe0
movq %rbx, %rsi
callq 0x21d0
cmpl $0x0, (%rbx)
je 0x2b17
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movq 0x472d(%rip), %rsi      # 0x6fe0
leaq 0xa8(%rsp), %rdi
callq 0x3494
xorl %eax, %eax
leaq 0x90(%rsp), %r12
movq %rax, -0x18(%r12)
movq %r12, -0x10(%r12)
movq %rax, -0x8(%r12)
movb %al, (%r12)
movb %al, 0x10(%r12)
movq 0xa8(%rsp), %rax
movq 0xb0(%rsp), %rsi
leaq 0xe0(%rsp), %rdi
movq %rax, -0x8(%rdi)
leaq 0xf0(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0xb8(%rsp), %rdx
addq %rsi, %rdx
callq 0x4170
movb 0xd0(%rsp), %al
movb %al, 0x100(%rsp)
movq 0x78(%rsp), %rax
movq 0x80(%rsp), %rsi
leaq 0x110(%rsp), %rdi
movq %rax, -0x8(%rdi)
leaq 0x120(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x88(%rsp), %rdx
addq %rsi, %rdx
callq 0x4170
movb 0xa0(%rsp), %al
leaq 0x108(%rsp), %rsi
movb %al, 0x28(%rsi)
leaq 0xd8(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0x34e1
movq 0x110(%rsp), %rdi
cmpq %r15, %rdi
je 0x299e
movq 0x120(%rsp), %rsi
incq %rsi
callq 0x2140
movq 0xe0(%rsp), %rdi
cmpq %r14, %rdi
je 0x29bb
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x2140
movl 0xc(%rsp), %esi
leaq 0x60(%rsp), %rdi
leaq 0x48(%rsp), %rdx
callq 0x36c6
movl 0xc(%rsp), %esi
leaq 0x48(%rsp), %rdi
leaq 0x30(%rsp), %rdx
callq 0x36c6
movq 0x10(%rsp), %rdi
movl 0xc(%rsp), %esi
shlq $0x5, %rsi
addq %rdi, %rsi
movq 0x60(%rsp), %rdx
leaq -0x53c(%rip), %rcx      # 0x24c1
callq 0x374e
movl 0xc(%rsp), %edi
shlq $0x5, %rdi
addq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq 0x48(%rsp), %rdx
leaq -0x55f(%rip), %rcx      # 0x24c1
callq 0x374e
leaq 0x30(%rsp), %rdi
leaq 0x60(%rsp), %rsi
leaq 0x48(%rsp), %rdx
callq 0x2672
cmpl $0x0, 0xc(%rsp)
je 0x2aa0
xorl %ebx, %ebx
movq 0x4587(%rip), %r14      # 0x6fd0
leaq 0xb(%rsp), %r15
movq %r14, %rdi
movq %rbx, %rsi
callq 0x20c0
movb $0x2c, 0xb(%rsp)
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x2150
movq 0x30(%rsp), %rcx
movq (%rcx,%rbx,8), %rsi
movq %rax, %rdi
callq 0x20c0
movb $0xa, 0xb(%rsp)
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x2150
incq %rbx
movl 0xc(%rsp), %eax
cmpq %rax, %rbx
jb 0x2a4e
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x2ab7
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x2140
leaq 0x48(%rsp), %rdi
callq 0x37ba
leaq 0x60(%rsp), %rdi
callq 0x37ba
movq 0x80(%rsp), %rdi
cmpq %r12, %rdi
je 0x2ae8
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x2140
leaq 0xc0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2b09
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x2140
leaq 0x10(%rsp), %rdi
callq 0x3808
xorl %eax, %eax
jmp 0x2b1c
movl $0x1, %eax
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x2b2f
jmp 0x2b2f
movq %rax, %rbx
jmp 0x2ba3
movq %rax, %rbx
jmp 0x2bad
jmp 0x2b7f
movq %rax, %rbx
movq 0x110(%rsp), %rdi
cmpq %r15, %rdi
je 0x2b60
movq 0x120(%rsp), %rsi
incq %rsi
callq 0x2140
jmp 0x2b60
movq %rax, %rbx
movq 0xe0(%rsp), %rdi
cmpq %r14, %rdi
je 0x2bb7
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x2140
jmp 0x2bb7
movq %rax, %rbx
jmp 0x2bb7
movq %rax, %rbx
jmp 0x2bf5
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x2ba3
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x2140
leaq 0x48(%rsp), %rdi
callq 0x37ba
leaq 0x60(%rsp), %rdi
callq 0x37ba
movq 0x80(%rsp), %rdi
cmpq %r12, %rdi
je 0x2bd4
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x2140
leaq 0xc0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2bf5
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x2140
leaq 0x10(%rsp), %rdi
callq 0x3808
movq %rbx, %rdi
callq 0x21e0