// File: kmyk[P]topcoder-marathon-match-100-same-color-pairs/./SameColorPairs.cpp
// Function: SameColorPairs::removePairs(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>)
vector<string> removePairs(vector<string> a_board) {
        double clock_begin = rdtsc();

        // parse input
        int H = a_board.size();
        int W = a_board[0].size();
        vector<vector<int> > board(H, vector<int>(W));
        int C = 0;
        REP (y, H) REP (x, W) {
            board[y][x] = a_board[y][x] - '0';
            chmax(C, board[y][x] + 1);
        }

        // assertion
        assert (10 <= H and H <= 100);
        assert (10 <= W and W <= 100);
        assert (2  <= C and C <= 6);

        // debug output
        cerr << "H = " << H << endl;
        cerr << "W = " << W << endl;
        cerr << "C = " << C << endl;
#ifdef LOCAL
        REP (y, H) {
            REP (x, W) {
                cerr << board[y][x];
            }
            cerr << endl;
        }
#endif

        // solve
        vector<array<int, 4> > result = solve(H, W, C, board);

        // make output
        vector<string> answer;
        for (auto rect : result) {
            ostringstream oss;
            oss << rect[0] << ' ';
            oss << rect[1] << ' ';
            oss << rect[2] << ' ';
            oss << rect[3];
            answer.push_back(oss.str());
        }
        double t = rdtsc() - clock_begin;
        cerr << "time = " << t << endl;
        cerr << "!\t" << H << "\t" << W << "\t" << C << "\t" << (H * W - 2 * int(answer.size())) << "\t" << t << endl;
        return answer;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x370, %rsp            # imm = 0x370
movq %rdx, -0x290(%rbp)
movq %rdi, -0x2a0(%rbp)
movq %rdi, %rax
movq %rax, -0x298(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
callq 0x7450
movq -0x290(%rbp), %rdi
movsd %xmm0, -0x20(%rbp)
callq 0x8720
movq -0x290(%rbp), %rdi
movl %eax, -0x24(%rbp)
xorl %eax, %eax
movl %eax, %esi
callq 0x8740
movq %rax, %rdi
callq 0x2150
movl %eax, -0x28(%rbp)
movslq -0x24(%rbp), %rax
movq %rax, -0x288(%rbp)
movslq -0x28(%rbp), %rax
movq %rax, -0x280(%rbp)
leaq -0x59(%rbp), %rdi
movq %rdi, -0x278(%rbp)
callq 0x6d30
movq -0x280(%rbp), %rsi
movq -0x278(%rbp), %rdx
leaq -0x58(%rbp), %rdi
callq 0x6d50
jmp 0x7e82
leaq -0x6d(%rbp), %rdi
movq %rdi, -0x2a8(%rbp)
callq 0x6dc0
movq -0x288(%rbp), %rsi
movq -0x2a8(%rbp), %rcx
leaq -0x40(%rbp), %rdi
leaq -0x58(%rbp), %rdx
callq 0x6de0
jmp 0x7eaf
leaq -0x6d(%rbp), %rdi
callq 0x6e60
leaq -0x58(%rbp), %rdi
callq 0x6e80
leaq -0x59(%rbp), %rdi
callq 0x6ee0
movl $0x0, -0x74(%rbp)
movl $0x0, -0x78(%rbp)
movl -0x78(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x7ff4
movl $0x0, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0x7fe4
movq -0x290(%rbp), %rdi
movslq -0x78(%rbp), %rsi
callq 0x8740
movq %rax, %rdi
movslq -0x7c(%rbp), %rsi
callq 0x23a0
movq %rax, -0x2b0(%rbp)
jmp 0x7f1c
movq -0x2b0(%rbp), %rax
movsbl (%rax), %eax
addl $-0x30, %eax
movl %eax, -0x2bc(%rbp)
movslq -0x78(%rbp), %rsi
leaq -0x40(%rbp), %rdi
movq %rdi, -0x2b8(%rbp)
callq 0x6f20
movq %rax, %rdi
movslq -0x7c(%rbp), %rsi
callq 0x6f00
movl -0x2bc(%rbp), %ecx
movq -0x2b8(%rbp), %rdi
movl %ecx, (%rax)
movslq -0x78(%rbp), %rsi
callq 0x6f20
movq %rax, %rdi
movslq -0x7c(%rbp), %rsi
callq 0x6f00
movl (%rax), %eax
incl %eax
movl %eax, -0x80(%rbp)
leaq -0x74(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x90f0
jmp 0x7f89
jmp 0x7f8b
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x7eeb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x7fc5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x6d(%rbp), %rdi
callq 0x6e60
leaq -0x58(%rbp), %rdi
callq 0x6e80
leaq -0x59(%rbp), %rdi
callq 0x6ee0
jmp 0x85c7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x85be
jmp 0x7fe6
movl -0x78(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x78(%rbp)
jmp 0x7ed8
xorl %eax, %eax
movl $0xa, %ecx
cmpl -0x24(%rbp), %ecx
movb %al, -0x2bd(%rbp)
jg 0x8013
cmpl $0x64, -0x24(%rbp)
setle %al
movb %al, -0x2bd(%rbp)
movb -0x2bd(%rbp), %al
testb $0x1, %al
jne 0x801f
jmp 0x8021
jmp 0x8040
leaq 0x112cf(%rip), %rdi     # 0x192f7
leaq 0x11222(%rip), %rsi     # 0x19251
movl $0x259, %edx            # imm = 0x259
leaq 0x112d1(%rip), %rcx     # 0x1930c
callq 0x2120
xorl %eax, %eax
movl $0xa, %ecx
cmpl -0x28(%rbp), %ecx
movb %al, -0x2be(%rbp)
jg 0x805f
cmpl $0x64, -0x28(%rbp)
setle %al
movb %al, -0x2be(%rbp)
movb -0x2be(%rbp), %al
testb $0x1, %al
jne 0x806b
jmp 0x806d
jmp 0x808c
leaq 0x112d3(%rip), %rdi     # 0x19347
leaq 0x111d6(%rip), %rsi     # 0x19251
movl $0x25a, %edx            # imm = 0x25A
leaq 0x11285(%rip), %rcx     # 0x1930c
callq 0x2120
xorl %eax, %eax
movl $0x2, %ecx
cmpl -0x74(%rbp), %ecx
movb %al, -0x2bf(%rbp)
jg 0x80ab
cmpl $0x6, -0x74(%rbp)
setle %al
movb %al, -0x2bf(%rbp)
movb -0x2bf(%rbp), %al
testb $0x1, %al
jne 0x80b7
jmp 0x80b9
jmp 0x80d8
leaq 0x1129c(%rip), %rdi     # 0x1935c
leaq 0x1118a(%rip), %rsi     # 0x19251
movl $0x25b, %edx            # imm = 0x25B
leaq 0x11239(%rip), %rcx     # 0x1930c
callq 0x2120
movq 0x1cf11(%rip), %rdi     # 0x24ff0
leaq 0x11288(%rip), %rsi     # 0x1936e
callq 0x21f0
movq %rax, -0x2c8(%rbp)
jmp 0x80f4
movq -0x2c8(%rbp), %rdi
movl -0x24(%rbp), %esi
callq 0x2330
movq %rax, -0x2d0(%rbp)
jmp 0x810c
movq -0x2d0(%rbp), %rdi
movq 0x1ce9e(%rip), %rsi     # 0x24fb8
callq 0x2230
jmp 0x8121
movq 0x1cec8(%rip), %rdi     # 0x24ff0
leaq 0x11244(%rip), %rsi     # 0x19373
callq 0x21f0
movq %rax, -0x2d8(%rbp)
jmp 0x813d
movq -0x2d8(%rbp), %rdi
movl -0x28(%rbp), %esi
callq 0x2330
movq %rax, -0x2e0(%rbp)
jmp 0x8155
movq -0x2e0(%rbp), %rdi
movq 0x1ce55(%rip), %rsi     # 0x24fb8
callq 0x2230
jmp 0x816a
movq 0x1ce7f(%rip), %rdi     # 0x24ff0
leaq 0x11200(%rip), %rsi     # 0x19378
callq 0x21f0
movq %rax, -0x2e8(%rbp)
jmp 0x8186
movq -0x2e8(%rbp), %rdi
movl -0x74(%rbp), %esi
callq 0x2330
movq %rax, -0x2f0(%rbp)
jmp 0x819e
movq -0x2f0(%rbp), %rdi
movq 0x1ce0c(%rip), %rsi     # 0x24fb8
callq 0x2230
jmp 0x81b3
movl -0x24(%rbp), %esi
movl -0x28(%rbp), %edx
movl -0x74(%rbp), %ecx
leaq -0x98(%rbp), %rdi
leaq -0x40(%rbp), %r8
callq 0x3900
jmp 0x81ce
movq -0x2a0(%rbp), %rdi
movb $0x0, -0x99(%rbp)
callq 0x9120
leaq -0x98(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rdi
callq 0x6fb0
movq %rax, -0xb0(%rbp)
movq -0xa8(%rbp), %rdi
callq 0x6fe0
movq %rax, -0xb8(%rbp)
leaq -0xb0(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x7010
testb $0x1, %al
jne 0x8231
jmp 0x83c1
leaq -0xb0(%rbp), %rdi
callq 0x7050
movups (%rax), %xmm0
movaps %xmm0, -0xd0(%rbp)
leaq -0x248(%rbp), %rdi
callq 0x22b0
jmp 0x8255
xorl %eax, %eax
movl %eax, %esi
leaq -0xd0(%rbp), %rdi
callq 0x7070
movl (%rax), %esi
leaq -0x248(%rbp), %rdi
callq 0x2330
movq %rax, -0x2f8(%rbp)
jmp 0x827c
movq -0x2f8(%rbp), %rdi
movl $0x20, %esi
callq 0x2280
jmp 0x828f
leaq -0xd0(%rbp), %rdi
movl $0x1, %esi
callq 0x7070
movl (%rax), %esi
leaq -0x248(%rbp), %rdi
callq 0x2330
movq %rax, -0x300(%rbp)
jmp 0x82b7
movq -0x300(%rbp), %rdi
movl $0x20, %esi
callq 0x2280
jmp 0x82ca
leaq -0xd0(%rbp), %rdi
movl $0x2, %esi
callq 0x7070
movl (%rax), %esi
leaq -0x248(%rbp), %rdi
callq 0x2330
movq %rax, -0x308(%rbp)
jmp 0x82f2
movq -0x308(%rbp), %rdi
movl $0x20, %esi
callq 0x2280
jmp 0x8305
leaq -0xd0(%rbp), %rdi
movl $0x3, %esi
callq 0x7070
movl (%rax), %esi
leaq -0x248(%rbp), %rdi
callq 0x2330
jmp 0x8326
leaq -0x268(%rbp), %rdi
leaq -0x248(%rbp), %rsi
callq 0x2220
jmp 0x833b
movq -0x2a0(%rbp), %rdi
leaq -0x268(%rbp), %rsi
callq 0x9140
jmp 0x8350
leaq -0x268(%rbp), %rdi
callq 0x2110
leaq -0x248(%rbp), %rdi
callq 0x2050
leaq -0xb0(%rbp), %rdi
callq 0x70a0
jmp 0x8215
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x85a6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x83b0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x268(%rbp), %rdi
callq 0x2110
leaq -0x248(%rbp), %rdi
callq 0x2050
jmp 0x85a6
callq 0x7450
movsd -0x20(%rbp), %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, -0x270(%rbp)
movq 0x1cc12(%rip), %rdi     # 0x24ff0
leaq 0x10f98(%rip), %rsi     # 0x1937d
callq 0x21f0
movq %rax, -0x310(%rbp)
jmp 0x83f3
movq -0x310(%rbp), %rdi
movsd -0x270(%rbp), %xmm0
callq 0x2380
movq %rax, -0x318(%rbp)
jmp 0x8410
movq -0x318(%rbp), %rdi
movq 0x1cb9a(%rip), %rsi     # 0x24fb8
callq 0x2230
jmp 0x8425
movq 0x1cbc4(%rip), %rdi     # 0x24ff0
leaq 0x10f52(%rip), %rsi     # 0x19385
callq 0x21f0
movq %rax, -0x320(%rbp)
jmp 0x8441
movq -0x320(%rbp), %rdi
movl -0x24(%rbp), %esi
callq 0x2330
movq %rax, -0x328(%rbp)
jmp 0x8459
movq -0x328(%rbp), %rdi
leaq 0x10f1f(%rip), %rsi     # 0x19386
callq 0x21f0
movq %rax, -0x330(%rbp)
jmp 0x8475
movq -0x330(%rbp), %rdi
movl -0x28(%rbp), %esi
callq 0x2330
movq %rax, -0x338(%rbp)
jmp 0x848d
movq -0x338(%rbp), %rdi
leaq 0x10eeb(%rip), %rsi     # 0x19386
callq 0x21f0
movq %rax, -0x340(%rbp)
jmp 0x84a9
movq -0x340(%rbp), %rdi
movl -0x74(%rbp), %esi
callq 0x2330
movq %rax, -0x348(%rbp)
jmp 0x84c1
movq -0x348(%rbp), %rdi
leaq 0x10eb7(%rip), %rsi     # 0x19386
callq 0x21f0
movq %rax, -0x350(%rbp)
jmp 0x84dd
movq -0x2a0(%rbp), %rdi
movl -0x24(%rbp), %eax
movl -0x28(%rbp), %ecx
imull %ecx, %eax
movl %eax, -0x35c(%rbp)
callq 0x8720
movl -0x35c(%rbp), %esi
movq -0x350(%rbp), %rdi
addl %eax, %eax
subl %eax, %esi
callq 0x2330
movq %rax, -0x358(%rbp)
jmp 0x8517
movq -0x358(%rbp), %rdi
leaq 0x10e61(%rip), %rsi     # 0x19386
callq 0x21f0
movq %rax, -0x368(%rbp)
jmp 0x8533
movq -0x368(%rbp), %rdi
movsd -0x270(%rbp), %xmm0
callq 0x2380
movq %rax, -0x370(%rbp)
jmp 0x8550
movq -0x370(%rbp), %rdi
movq 0x1ca5a(%rip), %rsi     # 0x24fb8
callq 0x2230
jmp 0x8565
movb $0x1, -0x99(%rbp)
testb $0x1, -0x99(%rbp)
jne 0x8581
movq -0x2a0(%rbp), %rdi
callq 0x86c0
leaq -0x98(%rbp), %rdi
callq 0x70c0
leaq -0x40(%rbp), %rdi
callq 0x7120
movq -0x298(%rbp), %rax
addq $0x370, %rsp            # imm = 0x370
popq %rbp
retq
movq -0x2a0(%rbp), %rdi
callq 0x86c0
leaq -0x98(%rbp), %rdi
callq 0x70c0
leaq -0x40(%rbp), %rdi
callq 0x7120
movq -0x68(%rbp), %rdi
callq 0x2340