#include <bits/stdc++.h>
using namespace std;
long long bin_pow(long long a, long long b) {
  if (b == 0) return 1;
  if (b % 2 == 0) {
    long long t = bin_pow(a, b / 2);
    return t * t % 1000000007;
  } else
    return a * bin_pow(a, b - 1) % 1000000007;
}
char s[100][100];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long t = 1, n, m, k = 0, sum = 0, l = 0, r = 0, x = 0, y = 0, z = 0,
            ans = 0, mn = LLONG_MAX, mx = LLONG_MIN;
  cin >> t;
  while (t--) {
    ans = z = 0;
    cin >> n >> m;
    vector<pair<long long, long long> > v;
    for (int i = 0; i < n; i++)
      for (int j = 0; j < m; j++) cin >> s[i][j];
    for (int i = 0; i < n; i += 2) {
      for (int j = 0; j < m; j += 2) {
        if (i + 1 >= n) {
          i -= 3;
          if (j + 1 >= m) {
            j -= 3;
          }
          continue;
        }
        if (j + 1 >= m) {
          j -= 3;
          continue;
        }
        x = 0;
        if (s[i][j] == '1') x++;
        if (s[i][j + 1] == '1') x++;
        if (s[i + 1][j] == '1') x++;
        if (s[i + 1][j + 1] == '1') x++;
        if (x == 0) continue;
        if (x == 1) {
          pair<long long, long long> a, b, c, d;
          a = make_pair(i, j);
          b = make_pair(i + 1, j);
          c = make_pair(i, j + 1);
          d = make_pair(i + 1, j + 1);
          if (s[i][j] == '1')
            ;
          else if (s[i][j + 1] == '1')
            swap(a, c);
          else if (s[i + 1][j] == '1')
            swap(a, b);
          else if (s[i + 1][j + 1] == '1')
            swap(a, d);
          v.push_back(a);
          v.push_back(b);
          v.push_back(c);
          v.push_back(a);
          v.push_back(b);
          v.push_back(d);
          v.push_back(a);
          v.push_back(d);
          v.push_back(c);
        } else if (x == 2) {
          pair<long long, long long> a, b, c, d;
          a = make_pair(i, j);
          b = make_pair(i + 1, j);
          c = make_pair(i, j + 1);
          d = make_pair(i + 1, j + 1);
          if (s[i][j] == '1')
            ;
          if (s[i + 1][j] == '1')
            ;
          if (s[i][j + 1] == '1') {
            if (s[i][j] == '0')
              swap(a, c);
            else
              swap(b, c);
          }
          if (s[i + 1][j + 1] == '1') {
            if (s[a.first][a.second] == '0')
              swap(a, d);
            else
              swap(b, d);
          }
          v.push_back(a);
          v.push_back(d);
          v.push_back(c);
          v.push_back(c);
          v.push_back(b);
          v.push_back(d);
        } else if (x == 3) {
          pair<long long, long long> a, b, c, d;
          a = make_pair(i, j);
          b = make_pair(i + 1, j);
          c = make_pair(i, j + 1);
          d = make_pair(i + 1, j + 1);
          if (s[i][j] == '0') swap(a, d);
          if (s[i][j + 1] == '0') swap(c, d);
          if (s[i + 1][j] == '0') swap(d, b);
          v.push_back(a);
          v.push_back(b);
          v.push_back(c);
        } else {
          pair<long long, long long> a, b, c, d;
          a = make_pair(i, j);
          b = make_pair(i + 1, j);
          c = make_pair(i, j + 1);
          d = make_pair(i + 1, j + 1);
          v.push_back(a);
          v.push_back(b);
          v.push_back(d);
          v.push_back(a);
          v.push_back(c);
          v.push_back(d);
          v.push_back(b);
          v.push_back(d);
          v.push_back(c);
          v.push_back(a);
          v.push_back(b);
          v.push_back(c);
        }
        s[i][j] = s[i][j + 1] = s[i + 1][j] = s[i + 1][j + 1] = '0';
      }
    }
    cout << v.size() / 3 << "\n";
    for (auto u : v) cout << u.first + 1 << " " << u.second + 1 << "\n";
    cout << "\n";
  }
  return 0;
}
