#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, m, i, j, c = 0, a, b;
    cin >> n >> m;
    vector<string> s(n);
    for (i = 0; i < n; i++) {
      cin >> s[i];
    }
    for (i = 0; i < n; i++) {
      for (j = 0; j < m; j++) {
        if (s[i][j] == '1') {
          c++;
        }
      }
    }
    cout << 3 * c << endl;
    for (i = 0; i < n; i++) {
      for (j = 0; j < m; j++) {
        if (s[i][j] == '1') {
          a = i + 1;
          b = j + 1;
          int c = (a < n) ? a + 1 : a - 1;
          int d = (b < m) ? b + 1 : b - 1;
          cout << a << " " << b << " ";
          cout << a << " " << d << " ";
          cout << c << " " << b << " ";
          cout << endl;
          cout << a << " " << b << " ";
          cout << c << " " << d << " ";
          cout << a << " " << d << " ";
          cout << endl;
          cout << a << " " << b << " ";
          cout << c << " " << d << " ";
          cout << c << " " << b << " ";
        }
      }
    }
  }
  return 0;
}
