#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;
}
