#include <bits/stdc++.h>
using namespace std;
int a[200][200];
vector<vector<pair<int, int> > > v;
int work(int x, int y) {
  int cnt = 0;
  for (int i = x; i <= x + 1; i++) {
    for (int j = y; j <= y + 1; j++) {
      if (a[i][j] == 1) cnt++;
    }
  }
  vector<pair<int, int> > ans;
  if (cnt == 0) {
    return 1;
  } else if (cnt == 1 || cnt == 2) {
    int c0 = 2, c1 = 1;
    for (int i = x; i <= x + 1; i++) {
      for (int j = y; j <= y + 1; j++) {
        if (a[i][j] == 0 && c0) {
          ans.push_back(make_pair(i, j));
          a[i][j] ^= 1;
          c0--;
        } else if (a[i][j] == 1 && c1) {
          ans.push_back(make_pair(i, j));
          a[i][j] ^= 1;
          c1--;
        }
      }
    }
  } else if (cnt == 3) {
    for (int i = x; i <= x + 1; i++) {
      for (int j = y; j <= y + 1; j++) {
        if (a[i][j]) {
          ans.push_back(make_pair(i, j));
          a[i][j] ^= 1;
        }
      }
    }
  } else {
    for (int i = x; i <= x + 1; i++) {
      for (int j = y; j <= y + 1; j++) {
        if (a[i][j] && ans.size() < 3) {
          ans.push_back(make_pair(i, j));
          a[i][j] ^= 1;
        }
      }
    }
  }
  v.push_back(ans);
  return 0;
}
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    v.clear();
    int n, m;
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= m; j++) {
        scanf("%1d", &a[i][j]);
      }
    }
    for (int i = 1; i < n; i++) {
      for (int j = 1; j < m; j++) {
        while (!work(i, j))
          ;
      }
    }
    printf("%d\n", v.size());
    for (int i = 0; i < v.size(); i++) {
      for (int j = 0; j < 3; j++) {
        pair<int, int> p = v[i][j];
        printf("%d %d%c", p.first, p.second, " \n"[j == 2]);
      }
    }
  }
  return 0;
}
