#include <bits/stdc++.h>
using namespace std;
const char NL = '\n';
void read(vector<long long> &a);
inline void solve() {
  long long t;
  cin >> t;
  while (t--) {
    long long n, m;
    cin >> n >> m;
    vector<string> arr(n);
    for (long long i = 0; i < n; i++) cin >> arr[i];
    long long cnt = 0;
    for (long long i = 0; i < n; i++)
      for (long long j = 0; j < m; j++)
        if (arr[i][j] == '1') cnt += 3;
    cout << cnt << NL;
    for (long long i = 0; i < n; i++)
      for (long long j = 0; j < m; j++) {
        if (arr[i][j] == '1') {
          cnt += 3;
          if (j == 0) {
            if (i == 0) {
              cout << "1 1 1 2 2 2" << NL;
              cout << "1 1 1 2 2 1" << NL;
              cout << "1 1 2 1 2 2" << NL;
            } else {
              cout << i << " 2 " << i + 1 << " 2 " << i + 1 << " 1" << NL;
              cout << i << " 1 " << i + 1 << " 1 " << i + 1 << " 2" << NL;
              cout << i + 1 << " 1 " << i << " 1 " << i << " 2" << NL;
            }
          } else if (i == 0) {
            cout << "1 " << j << " 1 " << j + 1 << " 2 " << j + 1 << NL;
            cout << "1 " << j + 1 << " 1 " << j << " 2 " << j << NL;
            cout << "1 " << j + 1 << " 2 " << j + 1 << " 2 " << j << NL;
          } else {
            cout << i + 1 << " " << j << " " << i + 1 << " " << j + 1 << " "
                 << i << " " << j + 1 << NL;
            cout << i << " " << j << " " << i << " " << j + 1 << " " << i + 1
                 << " " << j + 1 << NL;
            cout << i << " " << j << " " << i + 1 << " " << j << " " << i + 1
                 << " " << j + 1 << NL;
          }
        }
      }
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  solve();
  fflush(stdin);
  fflush(stdout);
  return 0;
}
void read(vector<long long> &a) {
  for (auto &it : a) cin >> it;
}
