#include <bits/stdc++.h>
using namespace std;
const long long maxn = 300010;
const long long MOD = 1e9 + 7;
const long long MOD2 = 998244353;
const long long INF = 2e9;
const long long LINF = 4e18;
long long n, m, x, y, l, r, k, q;
map<long long, long long> M, N;
set<long long> S;
string s[150];
void solve() {
  long long cnt = 0;
  cin >> n >> m;
  for (long long i = 0; i < n; i++) {
    cin >> s[i];
    for (long long j = 0; j < m; j++) {
      cnt += (s[i][j] == '1');
    }
  }
  cnt *= 3;
  cout << cnt << "\n";
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < m; j++) {
      if (s[i][j] == '0') continue;
      long long x = i + 1, y = j + 1;
      long long n_x = x + 1, n_y = y + 1;
      if (n_x > n) n_x = i;
      if (n_y > m) n_y = j;
      cout << x << " " << y << " ";
      cout << n_x << " " << n_y << " ";
      cout << x << " " << n_y << " ";
      cout << "\n";
      cout << x << " " << y << " ";
      cout << n_x << " " << y << " ";
      cout << n_x << " " << n_y << " ";
      cout << "\n";
      cout << x << " " << y << " ";
      cout << n_x << " " << y << " ";
      cout << x << " " << n_y << " ";
      cout << "\n";
    }
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long t = 1;
  cin >> t;
  while (t--) solve();
}
