#include <bits/stdc++.h>
using namespace std;
const int N = 110;
long long read(void) {
  char ch = getchar();
  long long sum = 0;
  bool f = 0;
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  if (ch == '-') {
    f = 1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') sum = sum * 10 + ch - '0', ch = getchar();
  if (f) sum = -sum;
  return sum;
}
int T, n, m;
string st;
int col[N][N];
int tA;
struct node {
  int x1, y1, x2, y2, x3, y3;
} que[N * N * 3];
void update(int x, int y) {
  if (x + 1 <= n) {
    if (y + 1 <= m) {
      que[++tA] = (node){x, y, x, y + 1, x + 1, y + 1};
      que[++tA] = (node){x, y, x + 1, y, x + 1, y + 1};
      que[++tA] = (node){x, y, x + 1, y, x, y + 1};
    } else {
      que[++tA] = (node){x, y, x, y - 1, x + 1, y - 1};
      que[++tA] = (node){x, y, x + 1, y, x + 1, y - 1};
      que[++tA] = (node){x, y, x + 1, y, x, y - 1};
    }
  } else {
    if (y + 1 <= m) {
      que[++tA] = (node){x, y, x, y + 1, x - 1, y + 1};
      que[++tA] = (node){x, y, x - 1, y, x - 1, y + 1};
      que[++tA] = (node){x, y, x - 1, y, x, y + 1};
    } else {
      que[++tA] = (node){x, y, x, y - 1, x - 1, y - 1};
      que[++tA] = (node){x, y, x - 1, y, x - 1, y - 1};
      que[++tA] = (node){x, y, x - 1, y, x, y - 1};
    }
  }
}
void solve(void) {
  n = read();
  m = read();
  tA = 0;
  for (int i = 1; i <= n; i++) {
    cin >> st;
    for (int j = 1; j <= m; j++) col[i][j] = (st[j - 1] == '0') ? 0 : 1;
  }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      if (col[i][j] == 1) update(i, j);
  printf("%d\n", tA);
  for (int i = 1; i <= tA; i++)
    printf("%d %d %d %d %d %d\n", que[i].x1, que[i].y1, que[i].x2, que[i].y2,
           que[i].x3, que[i].y3);
  return;
}
int main() {
  T = read();
  while (T--) solve();
  return 0;
}
