#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, m;
  cin >> n >> m;
  string arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  vector<vector<int>> ans;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (arr[i][j] == '1') {
        int x = 1, y = 1;
        vector<int> v, v1, v2;
        if (i == n - 1) x = -1;
        if (j == m - 1) y = -1;
        v.push_back(i + 1);
        v.push_back(j + 1);
        v.push_back(i + 1 + x);
        v.push_back(j + 1);
        v.push_back(i + 1);
        v.push_back(j + 1 + y);
        v1.push_back(i + 1);
        v1.push_back(j + 1);
        v1.push_back(i + 1 + x);
        v1.push_back(j + 1);
        v1.push_back(i + 1 + x);
        v1.push_back(j + 1 + y);
        v2.push_back(i + 1);
        v2.push_back(j + 1);
        v2.push_back(i + 1);
        v2.push_back(j + 1 + y);
        v2.push_back(i + 1 + x);
        v2.push_back(j + 1 + y);
        ans.push_back(v);
        ans.push_back(v1);
        ans.push_back(v2);
      }
    }
  }
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++) {
    for (int j = 0; j < ans[i].size(); j++) cout << ans[i][j] << " ";
    cout << endl;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  cin >> t;
  for (int i = 1; i <= t; i++) {
    solve();
  }
  return 0;
}
