#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  long long t;
  cin >> t;
  while (t--) {
    long long n, m;
    cin >> n >> m;
    string vs[n];
    for (long long i = 0; i < n; i++) {
      cin >> vs[i];
    }
    vector<vector<long long>> ans;
    for (long long i = 0; i < n; i++)
      for (long long j = 0; j < m; j++) {
        if (vs[i][j] == '1') {
          long long a = 1, b = 1;
          if (i == n - 1) a = -1;
          if (j == m - 1) b = -1;
          ans.push_back({i, j, i + a, j, i + a, j + b});
          ans.push_back({i, j, i, j + b, i + a, j + b});
          ans.push_back({i, j, i + a, j, i, j + b});
        }
      }
    cout << ans.size() << endl;
    for (long long i = 0; i < ans.size(); i++) {
      for (long long j = 0; j < 6; j++) cout << ans[i][j] + 1 << ' ';
      cout << endl;
    }
  }
  return 0;
}
