#include <bits/stdc++.h>
using namespace std;
long long power(long long a, long long n) {
  if (n == 1) return a;
  if (n == 0) return 1;
  if (n % 2) return a * power(a * a, n / 2);
  return power(a * a, n / 2);
}
const long long md = 998244353;
const long long inf = (long long)1e18;
vector<pair<long long, long long>> adj[30];
bool linear() {
  for (long long i = 0; i < 26; ++i) {
    bool fo = 1;
    for (auto &x : adj[i])
      if (x.first != adj[i][0].first) fo = 0;
    if (fo) continue;
    fo = 1;
    for (auto &x : adj[i])
      if (x.second != adj[i][0].second) fo = 0;
    if (fo) continue;
    return 0;
  }
  return 1;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long t;
  cin >> t;
  while (t--) {
    long long n, m;
    cin >> n >> m;
    string s[n + 5];
    char lc = 'a';
    for (long long i = 0; i < n; ++i) cin >> s[i];
    for (long long i = 0; i < 30; ++i) adj[i].clear();
    for (long long i = 0; i < n; ++i) {
      for (long long j = 0; j < m; ++j) {
        if (s[i][j] == '.') continue;
        adj[s[i][j] - 'a'].push_back({i, j});
        if (s[i][j] > lc) lc = s[i][j];
      }
    }
    if (!linear()) {
      cout << "NO\n";
      continue;
    }
    vector<pair<pair<long long, long long>, pair<long long, long long>>> ans;
    vector<long long> cnt(30);
    bool poss = 1;
    for (long long i = 0; i < lc - 'a' + 1; ++i) {
      if ((long long)adj[i].size() == 0) {
        cnt[i + 1] += cnt[i] + 1;
        continue;
      }
      for (long long j = 0; j < cnt[i]; ++j)
        ans.push_back({adj[i][0], adj[i][0]});
      long long cr = adj[i][0].first, cc = adj[i][0].second;
      long long lr = adj[i].back().first, lc = adj[i].back().second;
      if (cr == lr) {
        while (cc != lc) {
          if (s[cr][cc] == '.' || s[cr][cc] - 'a' < i) {
            poss = 0;
            break;
          }
          cc++;
        }
        if (poss) ans.push_back({adj[i][0], adj[i].back()});
      } else {
        while (cr != lr) {
          if (s[cr][cc] == '.' || s[cr][cc] - 'a' < i) {
            poss = 0;
            break;
          }
          cr++;
        }
        if (poss) ans.push_back({adj[i][0], adj[i].back()});
      }
      if (!poss) break;
    }
    if (!poss)
      cout << "NO\n";
    else {
      cout << "YES\n" << (long long)ans.size() << "\n";
      for (auto &x : ans)
        cout << x.first.first + 1 << " " << x.first.second + 1 << " "
             << x.second.first + 1 << " " << x.second.second + 1 << "\n";
    }
  }
  return 0;
}
