#include <bits/stdc++.h>
using namespace std;
vector<pair<long long int, long long int>> z, o, tmp;
vector<pair<long long int, long long int>> ans;
char vec[109][109];
void call2() {
  ans.push_back(tmp[0]);
  ans.push_back(tmp[1]);
  ans.push_back(tmp[2]);
  ans.push_back(tmp[1]);
  ans.push_back(tmp[2]);
  ans.push_back(tmp[3]);
  ans.push_back(tmp[0]);
  ans.push_back(tmp[2]);
  ans.push_back(tmp[3]);
  ans.push_back(tmp[0]);
  ans.push_back(tmp[1]);
  ans.push_back(tmp[3]);
  return;
}
void call(long long int a, long long int b) {
  long long int i;
  z.clear();
  o.clear();
  tmp.clear();
  if (vec[a][b] == '0') {
    z.push_back({a, b});
  } else {
    o.push_back({a, b});
  }
  if (vec[a][b + 1] == '0') {
    z.push_back({a, b + 1});
  } else {
    o.push_back({a, b + 1});
  }
  if (vec[a + 1][b + 1] == '0') {
    z.push_back({a + 1, b + 1});
  } else {
    o.push_back({a + 1, b + 1});
  }
  if (vec[a + 1][b] == '0') {
    z.push_back({a + 1, b});
  } else {
    o.push_back({a + 1, b});
  }
  vec[a][b] = vec[a][b + 1] = vec[a + 1][b] = vec[a + 1][b + 1] = '0';
  if (z.size() == 4) {
    return;
  }
  if (z.size() == 1) {
    for (i = 0; i < 3; i++) {
      ans.push_back(o[i]);
    }
    return;
  }
  if (z.size() == 2) {
    ans.push_back(o[0]);
    ans.push_back(o[1]);
    ans.push_back(z[1]);
    ans.push_back(z[0]);
    ans.push_back(o[0]);
    ans.push_back(o[1]);
    tmp.push_back(o[1]);
    tmp.push_back(o[0]);
    tmp.push_back(z[1]);
    tmp.push_back(z[0]);
    call2();
    return;
  }
  if (z.size() == 3) {
    ans.push_back(z[0]);
    ans.push_back(z[1]);
    ans.push_back(z[2]);
    tmp.push_back(o[0]);
    tmp.push_back(z[2]);
    tmp.push_back(z[1]);
    tmp.push_back(z[0]);
    call2();
    return;
  }
  if (z.size() == 0) {
    tmp.push_back(o[1]);
    tmp.push_back(o[0]);
    tmp.push_back(o[2]);
    tmp.push_back(o[3]);
    call2();
    return;
  }
}
int main() {
  long long int a, b, c, d, e, i, j, k, l, n, m, x, y, t, p;
  scanf("%lld", &t);
  for (p = 1; p <= t; p++) {
    cin >> n >> m;
    string st;
    ans.clear();
    for (i = 1; i <= n; i++) {
      cin >> st;
      for (j = 1; j <= m; j++) {
        vec[i][j] = st[j - 1];
      }
    }
    for (i = 1; i < n; i++) {
      for (j = 1; j < m; j++) {
        call(i, j);
      }
    }
    l = ans.size();
    printf("%lld\n", l / 3);
    for (i = 0; i < l; i += 3) {
      printf("%lld %lld ", ans[i].first, ans[i].second);
      printf("%lld %lld ", ans[i + 1].first, ans[i + 1].second);
      printf("%lld %lld\n", ans[i + 2].first, ans[i + 2].second);
    }
  }
}
