#include <bits/stdc++.h>
using namespace std;
long long m = 1000000007;
long long fact(long long n);
int modInverse(int a, int m) {
  int m0 = m;
  int y = 0, x = 1;
  if (m == 1) return 0;
  while (a > 1) {
    int q = a / m;
    int t = m;
    m = a % m, a = t;
    t = y;
    y = x - q * y;
    x = t;
  }
  if (x < 0) x += m0;
  return x;
}
long long fact(long long n) {
  long long res = 1;
  for (long long i = 2; i <= n; i++) res = (res % m * i % m) % m;
  return res;
}
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n, m;
    cin >> n >> m;
    string s[n];
    for (long long i = 0; i < n; i++) {
      cin >> s[i];
    }
    long long c = 0;
    for (long long i = 0; i < n; i++) {
      for (long long j = 0; j < m; j++) {
        if (s[i][j] == '1') c++;
      }
    }
    cout << 3 * c << endl;
    for (long long i = 0; i < n - 1; i++) {
      for (long long j = 0; j < m - 1; j++) {
        if (s[i][j] == '1') {
          cout << i + 1 << " " << j + 1 << " " << i + 2 << " " << j + 1 << " "
               << i + 1 << " " << j + 2 << endl;
          cout << i + 1 << " " << j + 1 << " " << i + 2 << " " << j + 1 << " "
               << i + 2 << " " << j + 2 << endl;
          cout << i + 1 << " " << j + 1 << " " << i + 2 << " " << j + 2 << " "
               << i + 1 << " " << j + 2 << endl;
        }
      }
    }
    for (long long j = 0; j < m - 1; j++) {
      if (s[n - 1][j] == '1') {
        long long i = n - 1;
        cout << i + 1 << " " << j + 1 << " " << i << " " << j + 1 << " "
             << i + 1 << " " << j + 2 << endl;
        cout << i + 1 << " " << j + 1 << " " << i << " " << j + 1 << " " << i
             << " " << j + 2 << endl;
        cout << i + 1 << " " << j + 1 << " " << i + 1 << " " << j + 2 << " "
             << i << " " << j + 2 << endl;
      }
    }
    for (long long i = 0; i < n - 1; i++) {
      if (s[i][m - 1] == '1') {
        long long j = m - 1;
        cout << i + 1 << " " << j + 1 << " " << i + 2 << " " << j + 1 << " "
             << i + 1 << " " << j << endl;
        cout << i + 1 << " " << j + 1 << " " << i + 2 << " " << j + 1 << " "
             << i + 2 << " " << j << endl;
        cout << i + 1 << " " << j + 1 << " " << i + 1 << " " << j << " "
             << i + 2 << " " << j << endl;
      }
    }
    if (s[n - 1][m - 1] == '1') {
      long long i = n - 1, j = m - 1;
      cout << i + 1 << " " << j + 1 << " " << i << " " << j << " " << i << " "
           << j + 1 << endl;
      cout << i + 1 << " " << j + 1 << " " << i << " " << j << " " << i + 1
           << " " << j << endl;
      cout << i + 1 << " " << j + 1 << " " << i + 1 << " " << j << " " << i
           << " " << j + 1 << endl;
    }
  }
  return 0;
}
