#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 1e2 + 10;
char g[N][N];
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, m;
    cin >> n >> m;
    int ans = 0;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        cin >> g[i][j];
        if (g[i][j] == '1') ans++;
      }
    }
    cout << 3 * ans << '\n';
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        if (g[i][j] == '1') {
          if (i == n - 1 and j == m - 1) {
            cout << i + 1 << " " << j + 1 << " " << i + 1 << " " << j << " "
                 << i << " " << j + 1 << '\n';
            cout << i + 1 << " " << j + 1 << " " << i << " " << j << " "
                 << i + 1 << " " << j << '\n';
            cout << i + 1 << " " << j + 1 << " " << i << " " << j << " " << i
                 << " " << j + 1 << '\n';
          } else if (i == n - 1) {
            cout << i + 1 << " " << j + 1 << " " << i + 1 << " " << j + 2 << " "
                 << i << " " << j + 1 << '\n';
            cout << i + 1 << " " << j + 1 << " " << i + 1 << " " << j + 2 << " "
                 << i << " " << j + 2 << '\n';
            cout << i + 1 << " " << j + 1 << " " << i << " " << j + 1 << " "
                 << i << " " << j + 2 << '\n';
          } else if (j == m - 1) {
            cout << i + 1 << " " << j + 1 << " " << i + 1 << " " << j << " "
                 << i + 2 << " " << j + 1 << '\n';
            cout << i + 1 << " " << j + 1 << " " << i + 2 << " " << j + 1 << " "
                 << i + 2 << " " << j << '\n';
            cout << i + 1 << " " << j + 1 << " " << i + 2 << " " << j << " "
                 << i + 1 << " " << j << '\n';
          } else {
            cout << i + 1 << " " << j + 1 << " " << i + 1 << " " << j + 2 << " "
                 << i + 2 << " " << j + 1 << '\n';
            cout << i + 1 << " " << j + 1 << " " << i + 2 << " " << j + 1 << " "
                 << i + 2 << " " << j + 2 << '\n';
            cout << i + 1 << " " << j + 1 << " " << i + 2 << " " << j + 2 << " "
                 << i + 1 << " " << j + 2 << '\n';
          }
        }
      }
    }
  }
  return 0;
}
