#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return a % b ? gcd(b, a % b) : b; }
const long long mod = 1e9 + 7;
const long long inf = 0x3f3f3f3f;
long long qpow(long long a, long long b) {
  long long t = 1;
  while (b != 0) {
    if (b & 1) t = (t * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return t;
}
vector<vector<int>> sc;
string s;
int a[110][110];
void solve(int x, int y) {
  int ans = 0;
  vector<pair<int, int>> b, c;
  vector<int> d;
  for (int i = x; i < x + 2; ++i) {
    for (int j = y; j < y + 2; ++j) {
      ans += a[i][j];
      if (a[i][j])
        b.push_back({i, j});
      else
        c.push_back({i, j});
      a[i][j] = 0;
    }
  }
  if (ans == 0) return;
  if (ans == 4) {
    for (int i = 0; i < 3; ++i) {
      d.push_back(b[b.size() - 1].first);
      d.push_back(b[b.size() - 1].second);
      c.push_back(b[b.size() - 1]);
      b.pop_back();
    }
    sc.push_back(d);
    d.clear();
    ans = 1;
  }
  if (ans == 1) {
    d.push_back(b[0].first);
    d.push_back(b[0].second);
    d.push_back(c[1].first);
    d.push_back(c[1].second);
    d.push_back(c[2].first);
    d.push_back(c[2].second);
    swap(b[0].first, c[1].first);
    swap(b[0].second, c[1].second);
    b.push_back(c[2]);
    c.pop_back();
    ans = 2;
    sc.push_back(d);
    d.clear();
  }
  if (ans == 2) {
    d.push_back(b[0].first);
    d.push_back(b[0].second);
    d.push_back(c[0].first);
    d.push_back(c[0].second);
    d.push_back(c[1].first);
    d.push_back(c[1].second);
    swap(b[0].first, c[0].first);
    swap(b[0].second, c[0].second);
    b.push_back(c[1]);
    c.pop_back();
    ans = 3;
    sc.push_back(d);
    d.clear();
  }
  if (ans == 3) {
    for (auto& t : b) {
      d.push_back(t.first);
      d.push_back(t.second);
    }
    sc.push_back(d);
  }
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int T;
  cin >> T;
  while (T--) {
    int n, m;
    cin >> n >> m;
    sc.clear();
    for (int i = 1; i <= n; ++i) {
      cin >> s;
      for (int j = 1; j <= m; ++j) {
        a[i][j] = s[j - 1] - '0';
      }
    }
    for (int i = 1; i < n; i += 2) {
      for (int j = 1; j < m; j += 2) {
        solve(i, j);
      }
    }
    for (int i = 1; i < n; ++i) {
      solve(i, m - 1);
    }
    for (int j = 1; j < m; ++j) {
      solve(n - 1, j);
    }
    cout << sc.size() << endl;
    for (auto& tmp : sc) {
      for (auto& tt : tmp) {
        cout << tt << " ";
      }
      cout << endl;
    }
  }
  return 0;
}
