#include <bits/stdc++.h>
using namespace std;
int main() {
  int T;
  cin >> T;
  for (int TT = 1; TT <= T; TT++) {
    int n, m;
    cin >> n >> m;
    vector<string> tab(n);
    int cnt = 0;
    for (int i = 0; i < n; i++) {
      cin >> tab[i];
      for (int j = 0; j < m; j++) {
        cnt += tab[i][j] == '1';
      }
    }
    cout << 3 * cnt << endl;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        if (tab[i][j] == '0') {
          continue;
        }
        int dx = i + 1 < n ? 1 : -1;
        int dy = j + 1 < m ? 1 : -1;
        int x = i + 1;
        int y = j + 1;
        printf("%d %d %d %d %d %d\n", x, y, x + dx, y, x, y + dy);
        printf("%d %d %d %d %d %d\n", x + dx, y, x, y, x + dx, y + dy);
        printf("%d %d %d %d %d %d\n", x, y + dy, x, y, x + dx, y + dy);
      }
    }
  }
  return 0;
}
