#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int t;
  cin >> t;
  while (t--) {
    long long int n, m;
    cin >> n >> m;
    vector<string> v(n);
    for (auto& s : v) {
      cin >> s;
    }
    vector<vector<long long int>> p;
    for (auto i = 0; i < n; i++) {
      for (auto j = 0; j < m; j++) {
        if (v[i][j] == '1') {
          int x = i + 1, y = j + 1;
          if (i == n - 1) x -= 2;
          if (j == m - 1) y -= 2;
          p.push_back({i, j, i, y, x, j});
          p.push_back({i, j, i, y, x, y});
          p.push_back({i, j, x, j, x, y});
        }
      }
    }
    cout << p.size() << endl;
    for (auto v : p) {
      for (auto g : v) cout << g + 1 << " ";
      cout << endl;
    }
  }
  return 0;
}
