#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, m;
  cin >> n >> m;
  char a[102][102];
  int cnt = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      cin >> a[i][j];
      if (a[i][j] == '1') cnt++;
    }
  }
  cout << cnt * 3 << "\n";
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      if (a[i][j] == '1') {
        int c = 1;
        int d = 1;
        if (i == n) c = -1;
        if (j == m) d = -1;
        cout << i << " " << j << " " << i << " " << j + d << " " << i + c << " "
             << j + d << "\n";
        cout << i << " " << j << " " << i << " " << j + d << " " << i + c << " "
             << j << "\n";
        cout << i << " " << j << " " << i + c << " " << j << " " << i + c << " "
             << j + d << "\n";
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
