#include <bits/stdc++.h>
using namespace std;
const long long modm = 1e9 + 7;
template <typename T>
void read_array(vector<T> &arr, int start, int end) {
  for (int i = start; i <= end; i++) cin >> arr[i];
}
template <typename T>
void print_array(vector<T> &arr, int start, int end) {
  for (int i = start; i <= end; i++) cout << arr[i] << " ";
  cout << "\n";
}
long long powm(long long x, long long y, long long p) {
  long long ret = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) ret = (ret * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return ret;
}
long long powl(long long x, long long y) {
  long long ret = 1;
  while (y > 0) {
    if (y & 1) ret = (ret * x);
    y = y >> 1;
    x = (x * x);
  }
  return ret;
}
static inline void ltrim(std::string &s) {
  s.erase(s.begin(), std::find_if(s.begin(), s.end(),
                                  [](int ch) { return !std::isspace(ch); }));
}
static inline void rtrim(std::string &s) {
  s.erase(std::find_if(s.rbegin(), s.rend(),
                       [](int ch) { return !std::isspace(ch); })
              .base(),
          s.end());
}
static inline void trim(std::string &s) {
  ltrim(s);
  rtrim(s);
}
int t, n, m;
int a[101][101];
string str;
bool isv(int i, int j) { return (i >= 1 && j >= 1 && i <= n && j <= m); }
void g() {
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) cout << a[i][j] << " ";
    cout << "\n";
  }
}
vector<vector<int>> f(vector<int> x, vector<int> y) {
  bool az = true;
  for (int i = 0; i < 4; i++) az = az && a[x[i]][y[i]] == 0;
  if (az) return {};
  vector<vector<int>> ret;
  az = true;
  for (int i = 0; i < 4; i++) az = az && a[x[i]][y[i]] == 1;
  if (az) {
    ret.push_back({x[0], y[0], x[1], y[1], x[3], y[3]});
    ret.push_back({x[0], y[0], x[2], y[2], x[3], y[3]});
    ret.push_back({x[1], y[1], x[2], y[2], x[3], y[3]});
    ret.push_back({x[0], y[0], x[1], y[1], x[2], y[2]});
    return ret;
  }
  int c = 0, temp;
  for (int i = 0; i < 4; i++)
    if (a[x[i]][y[i]] == 0) c++, temp = i;
  if (c == 1) {
    vector<int> temp2;
    for (int i = 0; i < 4; i++)
      if (i != temp) {
        temp2.push_back(x[i]);
        temp2.push_back(y[i]);
      }
    ret.push_back(temp2);
    return ret;
  } else if (c == 2) {
    if (a[x[0]][y[0]] == 1 && a[x[1]][y[1]] == 1) {
      ret.push_back({x[0], y[0], x[2], y[2], x[3], y[3]});
      ret.push_back({x[1], y[1], x[2], y[2], x[3], y[3]});
    } else if (a[x[2]][y[2]] == 1 && a[x[3]][y[3]] == 1) {
      ret.push_back({x[0], y[0], x[1], y[1], x[2], y[2]});
      ret.push_back({x[0], y[0], x[1], y[1], x[3], y[3]});
    } else if (a[x[1]][y[1]] == 1 && a[x[3]][y[3]] == 1) {
      ret.push_back({x[0], y[0], x[1], y[1], x[2], y[2]});
      ret.push_back({x[0], y[0], x[2], y[2], x[3], y[3]});
    } else if (a[x[0]][y[0]] == 1 && a[x[2]][y[2]] == 1) {
      ret.push_back({x[0], y[0], x[1], y[1], x[3], y[3]});
      ret.push_back({x[1], y[1], x[2], y[2], x[3], y[3]});
    } else if (a[x[0]][y[0]] == 1 && a[x[3]][y[3]] == 1) {
      ret.push_back({x[0], y[0], x[1], y[1], x[2], y[2]});
      ret.push_back({x[1], y[1], x[2], y[2], x[3], y[3]});
    } else {
      ret.push_back({x[0], y[0], x[2], y[2], x[3], y[3]});
      ret.push_back({x[0], y[0], x[1], y[1], x[3], y[3]});
    }
    return ret;
  } else {
    if (a[x[0]][y[0]] == 1) {
      ret.push_back({x[0], y[0], x[1], y[1], x[2], y[2]});
      ret.push_back({x[0], y[0], x[1], y[1], x[3], y[3]});
      ret.push_back({x[0], y[0], x[2], y[2], x[3], y[3]});
    } else if (a[x[1]][y[1]] == 1) {
      ret.push_back({x[0], y[0], x[1], y[1], x[3], y[3]});
      ret.push_back({x[0], y[0], x[1], y[1], x[2], y[2]});
      ret.push_back({x[1], y[1], x[2], y[2], x[3], y[3]});
    } else if (a[x[2]][y[2]] == 1) {
      ret.push_back({x[0], y[0], x[2], y[2], x[3], y[3]});
      ret.push_back({x[1], y[1], x[2], y[2], x[3], y[3]});
      ret.push_back({x[0], y[0], x[1], y[1], x[2], y[2]});
    } else {
      ret.push_back({x[1], y[1], x[2], y[2], x[3], y[3]});
      ret.push_back({x[0], y[0], x[2], y[2], x[3], y[3]});
      ret.push_back({x[0], y[0], x[1], y[1], x[3], y[3]});
    }
    return ret;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  cin >> t;
  while (t--) {
    cin >> n >> m;
    for (int i = 1; i <= n; i++) {
      cin >> str;
      for (int j = 1; j <= m; j++) {
        a[i][j] = str[j - 1] - '0';
      }
    }
    vector<vector<int>> ops;
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= m; j++) {
        if (isv(i + 1, j + 1)) {
          vector<vector<int>> temp =
              f({i, i, i + 1, i + 1}, {j, j + 1, j, j + 1});
          ops.insert(ops.end(), temp.begin(), temp.end());
          a[i][j] = a[i][j + 1] = a[i + 1][j] = a[i + 1][j + 1] = 0;
        }
      }
    }
    cout << ops.size() << "\n";
    for (vector<int> xx : ops) {
      for (int xxx : xx) cout << xxx << " ";
      cout << "\n";
    }
  }
}
