#include <bits/stdc++.h>
using namespace std;
const long long INF = 2147483647;
const long long MOD = 1000000007;
const long long mod = 998244353;
const long long eps = 1e-12;
long long n, m;
long long arr[101][101];
vector<pair<long long, long long> > res;
void solve(long long r, long long c) {
  vector<pair<long long, long long> > v0, v1;
  for (long long i = r; i < r + 2; i++) {
    for (long long j = c; j < c + 2; j++) {
      if (arr[i][j] == 0) {
        v0.emplace_back(i, j);
      } else {
        v1.emplace_back(i, j);
      }
    }
  }
  if (v1.size() == 0) return;
  if (v1.size() >= 3) {
    for (long long i = 0; i < 3; i++) {
      res.push_back(v1[i]);
      arr[v1[i].first][v1[i].second] = 1 - arr[v1[i].first][v1[i].second];
    }
    if (v1.size() == 4) solve(r, c);
  }
  if (1 <= v1.size() and v1.size() <= 2) {
    res.push_back(v0[0]);
    arr[v0[0].first][v0[0].second] = 1 - arr[v0[0].first][v0[0].second];
    res.push_back(v0[1]);
    arr[v0[1].first][v0[1].second] = 1 - arr[v0[1].first][v0[1].second];
    res.push_back(v1[0]);
    arr[v1[0].first][v1[0].second] = 1 - arr[v1[0].first][v1[0].second];
    solve(r, c);
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  char in;
  long long T;
  cin >> T;
  while (T--) {
    cin >> n >> m;
    for (long long i = 0; i < n; i++) {
      for (long long j = 0; j < m; j++) {
        cin >> in;
        arr[i][j] = in - '0';
      }
    }
    res.clear();
    for (long long i = 0; i < n; i += 2) {
      for (long long j = 0; j < m; j += 2) {
        solve(min(i, n - 2), min(j, m - 2));
      }
    }
    cout << res.size() / 3 << endl;
    for (long long i = 0; i < res.size(); i += 3) {
      cout << res[i].first + 1 << " " << res[i].second + 1 << " "
           << res[i + 1].first + 1 << " " << res[i + 1].second + 1 << " "
           << res[i + 2].first + 1 << " " << res[i + 2].second + 1 << endl;
    }
  }
  return 0;
}
