#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void read(T &ret) {
  T x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  ret = x * f;
}
template <class T>
inline T lowbit(T x) {
  return x & (-x);
}
template <class T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
template <class T>
inline T Pow(T a, T b, T p) {
  T ret = 1;
  a %= p;
  for (; b; b >>= 1, a = a * a % p)
    if (b & 1) (ret *= a) %= p;
  return ret;
}
const int N = 110;
int n, m;
char mat[N][N];
int stk[N * N * 3][6], top;
int x1, x2, Y1, y2;
void push(int d) {
  if (d == 0) {
    top++;
    stk[top][0] = x1;
    stk[top][1] = Y1;
    stk[top][2] = x1 + 1;
    stk[top][3] = Y1;
    stk[top][4] = x1;
    stk[top][5] = Y1 + 1;
  } else if (d == 1) {
    top++;
    stk[top][0] = x1;
    stk[top][1] = Y1;
    stk[top][2] = x1 + 1;
    stk[top][3] = Y1;
    stk[top][4] = x1 + 1;
    stk[top][5] = Y1 + 1;
  } else if (d == 2) {
    top++;
    stk[top][0] = x1;
    stk[top][1] = Y1 + 1;
    stk[top][2] = x1 + 1;
    stk[top][3] = Y1;
    stk[top][4] = x1 + 1;
    stk[top][5] = Y1 + 1;
  } else {
    top++;
    stk[top][0] = x1;
    stk[top][1] = Y1;
    stk[top][2] = x1;
    stk[top][3] = Y1 + 1;
    stk[top][4] = x1 + 1;
    stk[top][5] = Y1 + 1;
  }
}
void solv(int x, int y) {
  if (x == 1)
    x1 = x, x2 = x + 1;
  else
    x1 = x - 1, x2 = x;
  if (y == 1)
    Y1 = y, y2 = y + 1;
  else
    Y1 = y - 1, y2 = y;
  if (x == x1 && y == Y1)
    push(0), push(1), push(3);
  else if (x == x1 + 1 && y == Y1)
    push(0), push(1), push(2);
  else if (x == x1 + 1 && y == Y1 + 1)
    push(1), push(2), push(3);
  else
    push(0), push(2), push(3);
}
int main() {
  int T;
  read(T);
  while (T--) {
    read(n);
    read(m);
    for (long long i = (1); i <= (n); i++) scanf("%s", mat[i] + 1);
    top = 0;
    for (long long i = (1); i <= (n); i++)
      for (long long j = (1); j <= (m); j++)
        if (mat[i][j] == '1') solv(i, j);
    printf("%d\n", top);
    for (long long i = (1); i <= (top); i++) {
      for (long long j = (0); j <= (5); j++) {
        printf("%d", stk[i][j]);
        if (j != 5) putchar(' ');
      }
      putchar('\n');
    }
  }
}
