#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
int64_t lol;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cerr.tie(nullptr);
  int64_t testc = 1;
  cin >> testc;
  while (testc--) {
    long long n, m;
    cin >> n >> m;
    string tab[105];
    long long sum = 0;
    for (long long i = 0; i < n; i++) {
      cin >> tab[i];
      for (long long ii = 0; ii < m; ii++) {
        sum += (tab[i][ii] - '0');
      }
    }
    sum *= 3;
    vector<pair<long long, long long>> out;
    cout << sum << "\n";
    for (long long i = 0; i < n; i++) {
      for (long long ii = 0; ii < m; ii++) {
        if (tab[i][ii] == '1') {
          if (i != (n - 1) && ii != (m - 1)) {
            out.push_back({i + 1, ii + 1});
            out.push_back({i + 1, ii + 2});
            out.push_back({i + 2, ii + 2});
            out.push_back({i + 1, ii + 1});
            out.push_back({i + 2, ii + 1});
            out.push_back({i + 2, ii + 2});
            out.push_back({i + 1, ii + 1});
            out.push_back({i + 1, ii + 2});
            out.push_back({i + 2, ii + 1});
          } else if (i != (n - 1) && ii == (m - 1)) {
            out.push_back({i + 1, ii + 1});
            out.push_back({i + 1, ii});
            out.push_back({i + 2, ii});
            out.push_back({i + 1, ii + 1});
            out.push_back({i + 2, ii});
            out.push_back({i + 2, ii + 1});
            out.push_back({i + 1, ii + 1});
            out.push_back({i + 1, ii});
            out.push_back({i + 2, ii + 1});
          } else if (i == (n - 1) && ii != (m - 1)) {
            out.push_back({i + 1, ii + 1});
            out.push_back({i + 1, ii + 2});
            out.push_back({i, ii + 2});
            out.push_back({i + 1, ii + 1});
            out.push_back({i, ii + 1});
            out.push_back({i, ii + 2});
            out.push_back({i + 1, ii + 1});
            out.push_back({i + 1, ii + 2});
            out.push_back({i, ii + 1});
          } else {
            out.push_back({i + 1, ii + 1});
            out.push_back({i + 1, ii});
            out.push_back({i, ii});
            out.push_back({i + 1, ii + 1});
            out.push_back({i + 1, ii});
            out.push_back({i, ii + 1});
            out.push_back({i + 1, ii + 1});
            out.push_back({i, ii + 1});
            out.push_back({i, ii});
          }
        }
      }
    }
    reverse(out.begin(), out.end());
    while (out.size()) {
      long long temp = 3;
      while (temp--) {
        cout << out.back().first << " " << out.back().second << " ";
        out.pop_back();
      }
      cout << "\n";
    }
  }
  return EXIT_SUCCESS;
}
