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>
#pragma comment(linker, "/STACK:512000000")
using namespace std;
using li = long long;
using ld = long double;
void solve(bool);
void precalc();
clock_t start;
int main() {
  start = clock();
  int t = 1;
  cout.sync_with_stdio(0);
  cin.tie(0);
  cout.precision(20);
  cout << fixed;
  cin >> t;
  precalc();
  while (t--) {
    solve(true);
  }
  cout.flush();
  return 0;
}
template <typename T>
T binpow(T q, T w, T mod) {
  if (!w) return 1 % mod;
  if (w & 1) return q * 1LL * binpow(q, w - 1, mod) % mod;
  return binpow(q * 1LL * q % mod, w / 2, mod);
}
template <typename T>
T gcd(T q, T w) {
  while (w) {
    q %= w;
    swap(q, w);
  }
  return q;
}
template <typename T>
T lcm(T q, T w) {
  return q / gcd(q, w) * w;
}
template <typename T>
void make_unique(vector<T>& vec) {
  sort(vec.begin(), vec.end());
  vec.erase(unique(vec.begin(), vec.end()), vec.end());
}
template <typename T>
void relax_min(T& cur, T val) {
  cur = min(cur, val);
}
template <typename T>
void relax_max(T& cur, T val) {
  cur = max(cur, val);
}
mt19937 rng(
    (unsigned long long)chrono::steady_clock::now().time_since_epoch().count());
void precalc() {}
void solve(__attribute__((unused)) bool read) {
  int n, m;
  cin >> n >> m;
  vector<vector<int>> matrix(n, vector<int>(m));
  for (int i = 0; i < n; ++i) {
    string s;
    cin >> s;
    for (int j = 0; j < m; ++j) {
      matrix[i][j] = s[j] - '0';
    }
  }
  vector<vector<pair<int, int>>> ops;
  auto add_op = [&](vector<pair<int, int>> vec) {
    assert(vec.size() == 3);
    ops.push_back(vec);
    for (auto item : vec) {
      matrix[item.first][item.second] ^= 1;
    }
  };
  for (int i = n - 1; i >= 2; --i) {
    for (int j = 0; j < m; ++j) {
      if (matrix[i][j]) {
        add_op({{i, j}, {i - 1, j}, {i - 1, (j == 0) ? (j + 1) : (j - 1)}});
      }
    }
    for (int j = 0; j < m; ++j) {
      assert(matrix[i][j] == 0);
    }
    matrix.pop_back();
  }
  n = matrix.size();
  for (int j = m - 1; j >= 2; --j) {
    for (int i = 0; i < n; ++i) {
      if (matrix[i][j]) {
        add_op({{i, j}, {i, j - 1}, {(i == 0) ? (i + 1) : (i - 1), j - 1}});
      }
    }
    for (int i = 0; i < n; ++i) {
      assert(matrix[i][j] == 0);
      matrix[i].pop_back();
    }
  }
  assert(matrix.size() == 2);
  assert(matrix[0].size() == 2);
  bool found = false;
  for (int m1 = 0; m1 < 4 && !found; ++m1) {
    for (int m2 = 0; m2 < 4; ++m2) {
      vector<pair<int, int>> centers;
      for (int i = 0; i < 2; ++i) {
        if (m1 & (1 << i)) {
          centers.push_back({0, i});
        }
        if (m2 & (1 << i)) {
          centers.push_back({1, i});
        }
      }
      auto new_matrix = matrix;
      for (auto item : centers) {
        for (int i = 0; i < 2; ++i) {
          for (int j = 0; j < 2; ++j) {
            if (item.first == i && item.second == j) {
              continue;
            }
            new_matrix[i][j] ^= 1;
          }
        }
      }
      if (new_matrix[0] == vector<int>{0, 0} &&
          new_matrix[1] == vector<int>{0, 0}) {
        for (auto item : centers) {
          vector<pair<int, int>> vec;
          for (int i = 0; i < 2; ++i) {
            for (int j = 0; j < 2; ++j) {
              if (item.first == i && item.second == j) {
                continue;
              }
              vec.push_back({i, j});
            }
          }
          add_op(vec);
        }
        found = true;
        break;
      }
    }
  }
  assert(found);
  assert(matrix[0] == vector<int>(2, 0));
  assert(matrix[1] == vector<int>(2, 0));
  cout << ops.size() << "\n";
  for (auto vec : ops) {
    for (auto item : vec) {
      cout << item.first + 1 << " " << item.second + 1 << " ";
    }
    cout << "\n";
  }
}