Problem: This is the easy version of the problem. The difference between the versions is in the number of possible operations that can be made. You can make hacks if and only if you solved both versions of the problem.

You are given a binary table of size n × m. This table consists of symbols 0 and 1.

You can make such operation: select 3 different cells that belong to one 2 × 2 square and change the symbols in these cells (change 0 to 1 and 1 to 0).

Your task is to make all symbols in the table equal to 0. You are allowed to make at most 3nm operations. You don't need to minimize the number of operations.

It can be proved that it is always possible.

Input

The first line contains a single integer t (1 ≤ t ≤ 5000) — the number of test cases. The next lines contain descriptions of test cases.

The first line of the description of each test case contains two integers n, m (2 ≤ n, m ≤ 100).

Each of the next n lines contains a binary string of length m, describing the symbols of the next row of the table.

It is guaranteed that the sum of nm for all test cases does not exceed 20000.

Output

For each test case print the integer k (0 ≤ k ≤ 3nm) — the number of operations.

In the each of the next k lines print 6 integers x_1, y_1, x_2, y_2, x_3, y_3 (1 ≤ x_1, x_2, x_3 ≤ n, 1 ≤ y_1, y_2, y_3 ≤ m) describing the next operation. This operation will be made with three cells (x_1, y_1), (x_2, y_2), (x_3, y_3). These three cells should be different. These three cells should belong into some 2 × 2 square.

Example

Input


5
2 2
10
11
3 3
011
101
110
4 4
1111
0110
0110
1111
5 5
01011
11001
00010
11011
10000
2 3
011
101


Output


1
1 1 2 1 2 2
2 
2 1 3 1 3 2
1 2 1 3 2 3
4
1 1 1 2 2 2 
1 3 1 4 2 3
3 2 4 1 4 2
3 3 4 3 4 4
4
1 2 2 1 2 2 
1 4 1 5 2 5 
4 1 4 2 5 1
4 4 4 5 3 4
2
1 3 2 2 2 3
1 2 2 1 2 2

Note

In the first test case, it is possible to make only one operation with cells (1, 1), (2, 1), (2, 2). After that, all symbols will be equal to 0.

In the second test case:

  * operation with cells (2, 1), (3, 1), (3, 2). After it the table will be: 
    
          
    011  
    001  
    000  
    

  * operation with cells (1, 2), (1, 3), (2, 3). After it the table will be: 
    
          
    000  
    000  
    000  
    




In the fifth test case:

  * operation with cells (1, 3), (2, 2), (2, 3). After it the table will be: 
    
          
    010  
    110  
    

  * operation with cells (1, 2), (2, 1), (2, 2). After it the table will be: 
    
          
    000  
    000  
    

Solution (in PYTHON3):

Solution:
import itertools
import math
import sys
import os
from collections import defaultdict

 
def is_debug():
    return "PYPY3_HOME" not in os.environ

def stdin_wrapper():
    data = '''1
2 2
11
11
3 3
011
101
110
4 4
1111
0110
0110
1111
5 5
01011
11001
00010
11011
10000
2 3
011
101

'''
    
    for line in data.split('\n'):
        yield line
 
if not is_debug():
    def stdin_wrapper():
        while True:
            yield sys.stdin.readline()
 
inputs = stdin_wrapper()
 
def input_wrapper():
    return next(inputs)
 


def get_str():
    if is_debug():
        return input_wrapper()

    return input()

def get(_type):
    if _type == str:
        return get_str()

    return _type(input_wrapper())
 
def get_arr(_type):
    return [_type(x) for x in input_wrapper().split()]
 

def tuplerize(method):
    def wrap(*args, **kwargs):
        res = method(*args, **kwargs)
        if not isinstance(res, (tuple, list)):
            res = (res, )

        return res
    return wrap

''' Solution '''

@tuplerize
def solve(n, m, mx):
    for i in range(n):
        mx[i] = [int(x) for x in mx[i]]

    y_starts = [2*i for i in range(n//2)]
    if n % 2:
        y_starts.append(n-2)

    x_starts = [2*i for i in range(m//2)]

    if m % 2:
        x_starts.append(m-2)

    # print([(x,y) for x in x_starts for y in  y_starts])

    result = []
    def show(mx):
        print('\n'.join([''.join([str(x) for x in row]) for row in mx]))

    def to_absolute(op, x, y):
        return (op[1] + y, op[0] + x, op[3] + y, op[2] + x, op[5] + y, op[4] + x)

    def apply(mx, op):
        for i in range(3):
            mx[op[2*i]][op[2*i+1]] = 1 - mx[op[2*i]][op[2*i+1]]

    

    for y in y_starts:
        for x in x_starts:
            # print('working with', x, y)
            coords = [(_x, _y) for _x in range(2) for _y in range(2)]
            colors = [mx[y+_y][x+_x] for _x, _y in coords]
            ones = sum(colors)

            if ones == 0:
                continue

            if ones == 4:
                c = coords[0]
                op = (*c, *(1 - c[0], c[1]), *(c[0], 1 - c[1]))
                result.append(to_absolute(op, x, y))
                apply(mx, result[-1])

            colors = [mx[y+_y][x+_x] for _x, _y in coords]
            ones = sum(colors)

            if ones == 1:
                one_index = colors.index(1)
                c = coords[one_index]
                op = (*c, *(1 - c[0], c[1]), *(c[0], 1 - c[1]))
                result.append(to_absolute(op, x, y))
                apply(mx, result[-1])

            colors = [mx[y+_y][x+_x] for _x, _y in coords]
            ones = sum(colors)

            if ones == 2:
                if colors[1] == colors[2]: # 1 0 0 1 checkers
                    one_index = colors.index(1)
                    c = coords[one_index]
                    op = (*c, *(1 - c[0], c[1]), *(c[0], 1 - c[1]))
                    result.append(to_absolute(op, x, y))
                    apply(mx, result[-1])
                else:
                    op = []
                    for i in range(len(colors)):
                        if colors[i] == 0:
                            op += [*coords[i]]

                    one_index = colors.index(1)
                    c = coords[one_index]
                    op += [*c]
                    op = tuple(op)
                    result.append(to_absolute(op, x, y))
                    apply(mx, result[-1])

            colors = [mx[y+_y][x+_x] for _x, _y in coords]
            ones = sum(colors)

            if ones == 3:
                zero_index = colors.index(0)
                c = coords[zero_index]
                op = (*(1-c[0], 1-c[1]), *(c[0], 1 - c[1]), *(1-c[0], c[1]))
                result.append(to_absolute(op, x, y))
                apply(mx, result[-1])

            
    #         show(mx)

    # print('after')
    # show(mx)
    # print(result)
    # print(sum([x for row in mx for x in row]))
    return str(len(result)) + '\n' + '\n'.join([' '.join([str(x+1) for x in row]) for row in result])



t = get(int)
for _ in range(t):
    n, m = get_arr(int)
    mx = [get_str() for _ in range(n)]
    print(*solve(n, m, mx))