#include <bits/stdc++.h>
using namespace std;
char arr[2001][2001];
int main() {
  int t;
  cin >> t;
  for (int o = 0; o < t; o++) {
    int n, m;
    cin >> n >> m;
    set<char> sc;
    char maxi = 'a';
    int yo1, yo2;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        cin >> arr[i][j];
        if (arr[i][j] != '.') {
          sc.insert(arr[i][j]);
          if (maxi <= arr[i][j]) {
            maxi = arr[i][j];
            yo1 = i;
            yo2 = j;
          }
        }
      }
    }
    if (sc.empty()) {
      cout << "YES" << '\n';
      cout << 0 << '\n';
      continue;
    }
    map<char, vector<pair<int, int> > > mp;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        mp[arr[i][j]].push_back({i, j});
      }
    }
    vector<pair<pair<int, int>, pair<int, int> > > vp;
    for (char a = 'a'; a <= maxi; a++) {
      if (mp[a].empty()) {
        vp.push_back({{yo1, yo2}, {yo1, yo2}});
        continue;
      }
      set<int> si1, si2;
      for (int i = 0; i < mp[a].size(); i++) {
        si1.insert(mp[a][i].first);
        si2.insert(mp[a][i].second);
      }
      if (si1.size() == 1) {
        vp.push_back(
            {{*si1.begin(), *si2.begin()}, {*si1.begin(), *si2.rbegin()}});
      } else if (si2.size() == 1) {
        vp.push_back(
            {{*si1.begin(), *si2.begin()}, {*si1.rbegin(), *si2.begin()}});
      } else {
        cout << "NO" << '\n';
        goto asdf;
      }
    }
    for (int i = 0; i < vp.size(); i++) {
      char u = 'a' + i;
      if (vp[i].first.first == vp[i].second.first) {
        for (int j = vp[i].first.second; j <= vp[i].second.second; j++) {
          if (arr[vp[i].first.first][j] < u) {
            cout << "NO" << '\n';
            goto asdf;
          }
        }
      }
      if (vp[i].first.second == vp[i].second.second) {
        for (int j = vp[i].first.first; j <= vp[i].second.first; j++) {
          if (arr[j][vp[i].first.second] < u) {
            cout << "NO" << '\n';
            goto asdf;
          }
        }
      }
    }
    cout << "YES" << '\n';
    cout << maxi - 'a' + 1 << '\n';
    for (int i = 0; i < vp.size(); i++)
      cout << vp[i].first.first + 1 << " " << vp[i].first.second + 1 << " "
           << vp[i].second.first + 1 << " " << vp[i].second.second + 1 << '\n';
  asdf:
    int u;
  }
  return 0;
}
