#include <bits/stdc++.h>
using namespace std;
struct otv {
  int a1, a2, a3, a4, a5, a6;
};
int n, m, i, j, t, tt, a[101][101];
char s[101];
vector<otv> ans;
otv q;
int main() {
  scanf("%d", &t);
  for (tt = 1; tt <= t; tt++) {
    ans.clear();
    scanf("%d%d\n", &n, &m);
    for (i = 1; i <= n; i++) {
      scanf("%s", &s);
      for (j = 1; j <= m; j++) a[i][j] = s[j - 1] - '0';
    }
    for (i = 1; i < n; i++)
      for (j = 1; j < m; j++) {
        if (a[i][j]) {
          q.a1 = i;
          q.a2 = j;
          q.a3 = i + 1;
          q.a4 = j;
          q.a5 = i;
          q.a6 = j + 1;
          ans.push_back(q);
          q.a1 = i;
          q.a2 = j;
          q.a3 = i + 1;
          q.a4 = j + 1;
          q.a5 = i;
          q.a6 = j + 1;
          ans.push_back(q);
          q.a1 = i;
          q.a2 = j;
          q.a3 = i + 1;
          q.a4 = j;
          q.a5 = i + 1;
          q.a6 = j + 1;
          ans.push_back(q);
        }
      }
    for (j = 1; j < m; j++) {
      if (a[n][j]) {
        i = n;
        q.a1 = i;
        q.a2 = j;
        q.a3 = i - 1;
        q.a4 = j;
        q.a5 = i;
        q.a6 = j + 1;
        ans.push_back(q);
        q.a1 = i;
        q.a2 = j;
        q.a3 = i - 1;
        q.a4 = j;
        q.a5 = i - 1;
        q.a6 = j + 1;
        ans.push_back(q);
        q.a1 = i;
        q.a2 = j;
        q.a3 = i;
        q.a4 = j + 1;
        q.a5 = i - 1;
        q.a6 = j + 1;
        ans.push_back(q);
      }
    }
    for (i = 1; i < n; i++) {
      if (a[i][m]) {
        j = m;
        q.a1 = i;
        q.a2 = j;
        q.a3 = i + 1;
        q.a4 = j;
        q.a5 = i;
        q.a6 = j - 1;
        ans.push_back(q);
        q.a1 = i;
        q.a2 = j;
        q.a3 = i;
        q.a4 = j - 1;
        q.a5 = i + 1;
        q.a6 = j - 1;
        ans.push_back(q);
        q.a1 = i;
        q.a2 = j;
        q.a3 = i + 1;
        q.a4 = j;
        q.a5 = i + 1;
        q.a6 = j - 1;
        ans.push_back(q);
      }
    }
    if (a[n][m]) {
      i = n;
      j = m;
      q.a1 = i;
      q.a2 = j;
      q.a3 = i - 1;
      q.a4 = j;
      q.a5 = i;
      q.a6 = j - 1;
      ans.push_back(q);
      q.a1 = i;
      q.a2 = j;
      q.a3 = i - 1;
      q.a4 = j;
      q.a5 = i - 1;
      q.a6 = j - 1;
      ans.push_back(q);
      q.a1 = i;
      q.a2 = j;
      q.a3 = i;
      q.a4 = j - 1;
      q.a5 = i - 1;
      q.a6 = j - 1;
      ans.push_back(q);
    }
    printf("%d\n", ans.size());
    for (i = 0; i < ans.size(); i++)
      printf("%d %d %d %d %d %d\n", ans[i].a1, ans[i].a2, ans[i].a3, ans[i].a4,
             ans[i].a5, ans[i].a6);
  }
}
