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 CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
char s[110][110];
int t, n, m, a[110][110];
struct node {
  int x1, y1, x2, y2, x3, y3;
};
vector<node> ans;
struct node2 {
  int x, y;
};
vector<node2> v;
void check(int x, int y) {
  v.clear();
  for (int i = 1; i <= 2; i++)
    for (int j = 1; j <= 2; j++) {
      if (a[x + i - 1][y + j - 1] == 0) {
        node2 temp;
        temp.x = x + i - 1, temp.y = y + j - 1;
        v.push_back(temp);
      }
    }
  int t = v.size();
  if (t == 4) return;
  if (t == 3) {
    node2 t1;
    for (int i = 1; i <= 2; i++)
      for (int j = 1; j <= 2; j++) {
        if (a[x + i - 1][y + j - 1] == 1) {
          t1.x = x + i - 1, t1.y = y + j - 1;
        }
      }
    node t2;
    t2.x1 = v[0].x, t2.y1 = v[0].y, t2.x2 = v[1].x, t2.y2 = v[1].y,
    t2.x3 = t1.x, t2.y3 = t1.y;
    node t3;
    t3.x1 = v[1].x, t3.y1 = v[1].y, t3.x2 = v[2].x, t3.y2 = v[2].y,
    t3.x3 = t1.x, t3.y3 = t1.y;
    node t4;
    t4.x1 = v[0].x, t4.y1 = v[0].y, t4.x2 = v[2].x, t4.y2 = v[2].y,
    t4.x3 = t1.x, t4.y3 = t1.y;
    ans.push_back(t2);
    ans.push_back(t3);
    ans.push_back(t4);
  }
  if (t == 2) {
    node2 t1, t2;
    int cnt = 0;
    for (int i = 1; i <= 2; i++)
      for (int j = 1; j <= 2; j++) {
        if (a[x + i - 1][y + j - 1] == 1) {
          if (cnt == 0)
            t1.x = x + i - 1, t1.y = y + j - 1;
          else
            t2.x = x + i - 1, t2.y = y + j - 1;
          cnt++;
        }
      }
    node tt2;
    tt2.x1 = v[0].x, tt2.y1 = v[0].y, tt2.x2 = v[1].x, tt2.y2 = v[1].y,
    tt2.x3 = t1.x, tt2.y3 = t1.y;
    node tt3;
    tt3.x1 = v[0].x, tt3.y1 = v[0].y, tt3.x2 = v[1].x, tt3.y2 = v[1].y,
    tt3.x3 = t2.x, tt3.y3 = t2.y;
    ans.push_back(tt2);
    ans.push_back(tt3);
  }
  if (t == 1) {
    node2 t1, t2, t3;
    int cnt = 0;
    for (int i = 1; i <= 2; i++)
      for (int j = 1; j <= 2; j++) {
        if (a[x + i - 1][y + j - 1] == 1) {
          if (cnt == 0)
            t1.x = x + i - 1, t1.y = y + j - 1;
          else if (cnt == 1)
            t2.x = x + i - 1, t2.y = y + j - 1;
          else
            t3.x = x + i - 1, t3.y = y + j - 1;
          cnt++;
        }
      }
    node t;
    t.x1 = t1.x, t.y1 = t1.y, t.x2 = t2.x, t.y2 = t2.y, t.x3 = t3.x,
    t.y3 = t3.y;
    ans.push_back(t);
  }
  if (t == 0) {
    node t;
    node2 tt, ttt, tttt;
    tt.x = x, tt.y = y, ttt.x = x, ttt.y = y + 1, tttt.x = x + 1, tttt.y = y;
    v.push_back(tt);
    v.push_back(ttt);
    v.push_back(tttt);
    t.x1 = x, t.y1 = y, t.x2 = x, t.y2 = y + 1, t.x3 = x + 1, t.y3 = y;
    ans.push_back(t);
    node2 t1;
    t1.x = x + 1, t1.y = y + 1;
    node tt2;
    tt2.x1 = v[0].x, tt2.y1 = v[0].y, tt2.x2 = v[1].x, tt2.y2 = v[1].y,
    tt2.x3 = t1.x, tt2.y3 = t1.y;
    node tt3;
    tt3.x1 = v[1].x, tt3.y1 = v[1].y, tt3.x2 = v[2].x, tt3.y2 = v[2].y,
    tt3.x3 = t1.x, tt3.y3 = t1.y;
    node tt4;
    tt4.x1 = v[0].x, tt4.y1 = v[0].y, tt4.x2 = v[2].x, tt4.y2 = v[2].y,
    tt4.x3 = t1.x, tt4.y3 = t1.y;
    ans.push_back(tt2);
    ans.push_back(tt3);
    ans.push_back(tt4);
  }
  for (int i = 1; i <= 2; i++)
    for (int j = 1; j <= 2; j++) a[x + i - 1][y + j - 1] = 0;
}
int main() {
  scanf("%d", &t);
  while (t--) {
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= n; i++) scanf("%s", s[i] + 1);
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= m; j++) a[i][j] = s[i][j] - '0';
    ans.clear();
    for (int i = 1; i <= n - 1; i++)
      for (int j = 1; j <= m - 1; j++) {
        check(i, j);
      }
    printf("%d\n", ans.size());
    for (int i = 0; i < ans.size(); i++)
      printf("%d %d %d %d %d %d\n", ans[i].x1, ans[i].y1, ans[i].x2, ans[i].y2,
             ans[i].x3, ans[i].y3);
  }
  return 0;
}