#include <bits/stdc++.h>
using namespace std;
void print(int x1, int y1, int x2, int y2, int x3, int y3) {
  cout << x1 << " " << y1 << " " << x2 << " " << y2 << " " << x3 << " " << y3
       << "\n";
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, m;
    cin >> n >> m;
    int cnt = 0;
    int a[n][m];
    for (int i = 0; i < n; i++) {
      string s;
      cin >> s;
      for (int j = 0; j < m; j++) {
        a[i][j] = s[j] - '0';
        if (s[j] == '1') cnt++;
      }
    }
    cout << cnt * 3 << "\n";
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        if (a[i][j] == 0) continue;
        int x1, x2, x3, y1, y2, y3;
        if (j == m - 1) {
          y1 = y3 = j - 1;
          y2 = j;
        } else {
          y1 = y3 = j + 1;
          y2 = j;
        }
        if (i == n - 1) {
          x1 = x2 = i - 1;
          x3 = i;
        } else {
          x1 = x2 = i + 1;
          x3 = i;
        }
        x1++, x2++, x3++, y1++, y2++, y3++;
        print(i + 1, j + 1, x1, y1, x3, y3);
        print(i + 1, j + 1, x2, y2, x3, y3);
        print(i + 1, j + 1, x1, y1, x2, y2);
      }
    }
  }
}
