#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pi = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
void solve() {
  ll n, m;
  cin >> n >> m;
  vector<string> tomb(n);
  ll mo = 0;
  for (long long int i = (0); i <= (n - 1); i++) {
    cin >> tomb[i];
    for (long long int j = (0); j <= (tomb[i].length()); j++) {
      if (tomb[i][j] == '1') {
        mo++;
      }
    }
  }
  cout << mo * 3 << endl;
  for (long long int i = (0); i <= (n - 1); i++) {
    for (long long int j = (0); j <= (m - 1); j++) {
      if (tomb[i][j] == '1') {
        if (i + 1 < n && j + 1 < m) {
          cout << i + 2 << " " << j + 2 << " " << i + 2 << " " << j + 1 << " "
               << i + 1 << " " << j + 1 << endl;
          cout << i + 2 << " " << j + 1 << " " << i + 1 << " " << j + 1 << " "
               << i + 1 << " " << j + 2 << endl;
          cout << i + 1 << " " << j + 1 << " " << i + 1 << " " << j + 2 << " "
               << i + 2 << " " << j + 2 << endl;
        } else if (i - 1 >= 0 && j + 1 < m) {
          cout << i << " " << j + 2 << " " << i + 1 << " " << j + 2 << " "
               << i + 1 << " " << j + 1 << endl;
          cout << i + 1 << " " << j + 2 << " " << i + 1 << " " << j + 1 << " "
               << i << " " << j + 1 << endl;
          cout << i + 1 << " " << j + 1 << " " << i << " " << j + 1 << " " << i
               << " " << j + 2 << endl;
        } else if (i + 1 < n && j - 1 >= 0) {
          cout << i + 2 << " " << j << " " << i + 1 << " " << j << " " << i + 1
               << " " << j + 1 << endl;
          cout << i + 1 << " " << j << " " << i + 1 << " " << j + 1 << " "
               << i + 2 << " " << j + 1 << endl;
          cout << i + 1 << " " << j + 1 << " " << i + 2 << " " << j + 1 << " "
               << i + 2 << " " << j << endl;
        } else if (i - 1 >= 0 && j - 1 >= 0) {
          cout << i << " " << j << " " << i << " " << j + 1 << " " << i + 1
               << " " << j + 1 << endl;
          cout << i << " " << j + 1 << " " << i + 1 << " " << j + 1 << " "
               << i + 1 << " " << j << endl;
          cout << i + 1 << " " << j + 1 << " " << i + 1 << " " << j << " " << i
               << " " << j << endl;
        }
      }
    }
  }
}
int main() {
  if (true) {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
  }
  ll t;
  cin >> t;
  while (t--) solve();
}
