// File: /workspace/github_cpp_makefile_star2_O3/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 0x46c2(%rip), %rdi      # 0x6fe0
movq %rbx, %rsi
callq 0x21d0
cmpl $0x0, (%rbx)
je 0x2bab
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movq 0x4699(%rip), %rsi      # 0x6fe0
leaq 0xa8(%rsp), %rdi
callq 0x3554
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 0x421e
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 0x421e
movb 0xa0(%rsp), %al
leaq 0x108(%rsp), %rsi
movb %al, 0x28(%rsi)
leaq 0xd8(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0x35a1
movq 0x110(%rsp), %rdi
cmpq %r15, %rdi
je 0x2a32
movq 0x120(%rsp), %rsi
incq %rsi
callq 0x2140
movq 0xe0(%rsp), %rdi
cmpq %r14, %rdi
je 0x2a4f
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x2140
movl 0xc(%rsp), %esi
leaq 0x60(%rsp), %rdi
leaq 0x48(%rsp), %rdx
callq 0x3786
movl 0xc(%rsp), %esi
leaq 0x48(%rsp), %rdi
leaq 0x30(%rsp), %rdx
callq 0x3786
movq 0x10(%rsp), %rdi
movl 0xc(%rsp), %esi
shlq $0x5, %rsi
addq %rdi, %rsi
movq 0x60(%rsp), %rdx
leaq -0x5d0(%rip), %rcx      # 0x24c1
callq 0x3804
movl 0xc(%rsp), %edi
shlq $0x5, %rdi
addq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq 0x48(%rsp), %rdx
leaq -0x5f3(%rip), %rcx      # 0x24c1
callq 0x3804
leaq 0x30(%rsp), %rdi
leaq 0x60(%rsp), %rsi
leaq 0x48(%rsp), %rdx
callq 0x2668
cmpl $0x0, 0xc(%rsp)
je 0x2b34
xorl %ebx, %ebx
movq 0x44f3(%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 0x2ae2
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x2b4b
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x2140
leaq 0x48(%rsp), %rdi
callq 0x3896
leaq 0x60(%rsp), %rdi
callq 0x3896
movq 0x80(%rsp), %rdi
cmpq %r12, %rdi
je 0x2b7c
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x2140
leaq 0xc0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2b9d
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x2140
leaq 0x10(%rsp), %rdi
callq 0x38ea
xorl %eax, %eax
jmp 0x2bb0
movl $0x1, %eax
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x2bc3
jmp 0x2bc3
movq %rax, %rbx
jmp 0x2c37
movq %rax, %rbx
jmp 0x2c41
jmp 0x2c13
movq %rax, %rbx
movq 0x110(%rsp), %rdi
cmpq %r15, %rdi
je 0x2bf4
movq 0x120(%rsp), %rsi
incq %rsi
callq 0x2140
jmp 0x2bf4
movq %rax, %rbx
movq 0xe0(%rsp), %rdi
cmpq %r14, %rdi
je 0x2c4b
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x2140
jmp 0x2c4b
movq %rax, %rbx
jmp 0x2c4b
movq %rax, %rbx
jmp 0x2c89
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x2c37
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x2140
leaq 0x48(%rsp), %rdi
callq 0x3896
leaq 0x60(%rsp), %rdi
callq 0x3896
movq 0x80(%rsp), %rdi
cmpq %r12, %rdi
je 0x2c68
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x2140
leaq 0xc0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2c89
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x2140
leaq 0x10(%rsp), %rdi
callq 0x38ea
movq %rbx, %rdi
callq 0x21e0