#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t;
  cin >> t;
  while (t--) {
    long long int n, m;
    cin >> n >> m;
    vector<string> A(n);
    for (long long int i = 0; i < n; i++) {
      cin >> A[i];
    }
    vector<vector<pair<long long int, long long int> > > B(
        26, vector<pair<long long int, long long int> >());
    for (long long int i = 0; i < n; i++) {
      for (long long int j = 0; j < m; j++) {
        if (A[i][j] != '.') {
          B[A[i][j] - 'a'].push_back({i, j});
        }
      }
    }
    long long int i = 25;
    while (i >= 0 && B[i].empty()) {
      i--;
    }
    long long int len = i;
    bool can = true;
    for (i = 0; i <= len; i++) {
      if (B[i].empty()) {
        if (i < len) {
          continue;
        }
      }
      pair<long long int, long long int> a = B[i][0], b = B[i][B[i].size() - 1];
      long long int ind = 0;
      if (a.first == b.first) {
        for (long long int j = a.second; j <= b.second; j++) {
          if (A[a.first][j] == (char)('a' + i) && a.first == B[i][ind].first &&
              j == B[i][ind].second) {
            ind++;
          } else if (A[a.first][j] <= (char)('a' + i) || A[a.first][j] == '.') {
            can = false;
            break;
          }
        }
      } else if (a.second == b.second) {
        for (long long int j = a.first; j <= b.first; j++) {
          if (A[j][a.second] == (char)('a' + i) && j == B[i][ind].first &&
              a.second == B[i][ind].second) {
            ind++;
          } else if (A[j][a.second] <= (char)('a' + i) ||
                     A[j][a.second] == '.') {
            can = false;
            break;
          }
        }
      } else {
        can = false;
        break;
      }
      if (ind != B[i].size()) can = false;
      if (!can) break;
    }
    if (!can) {
      cout << "NO"
           << "\n";
      continue;
    }
    cout << "YES"
         << "\n";
    cout << (len + 1) << "\n";
    for (i = len; i >= 0; i--) {
      if (B[i].empty()) {
        B[i] = B[i + 1];
      }
    }
    for (i = 0; i <= len; i++) {
      pair<long long int, long long int> a, b;
      a = B[i][0], b = B[i][B[i].size() - 1];
      cout << a.first + 1 << " " << a.second + 1 << " " << b.first + 1 << " "
           << b.second + 1 << "\n";
    }
  }
  return 0;
}
