#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, m;
  vector<pair<int, int> > v[28];
  vector<pair<int, int> > ans[28];
  cin >> n >> m;
  string second[n + 5];
  for (int i = 0; i < n; i++) cin >> second[i];
  int mx = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (second[i][j] == '.') continue;
      int ch = second[i][j] - 'a';
      mx = max(mx, ch + 1);
      v[ch].push_back({i, j});
    }
  }
  for (int i = 0; i < mx; i++) {
    if (v[i].empty()) {
      ans[i].push_back(v[mx - 1].back());
      ans[i].push_back(v[mx - 1].back());
      continue;
    }
    int row = 1, col = 1;
    for (int j = 0; j < v[i].size(); j++) {
      if (v[i][j].first != v[i][0].first) row = 0;
      if (v[i][j].second != v[i][0].second) col = 0;
    }
    if (!col && !row) {
      cout << "NO" << endl;
      return;
    }
    if (row) {
      int r = v[i][0].first;
      int p = v[i][0].second;
      int q = v[i][v[i].size() - 1].second;
      for (int j = p; j <= q; j++) {
        if (second[r][j] < i + 'a') {
          cout << "NO" << endl;
          return;
        }
      }
      ans[i].push_back({r, p});
      ans[i].push_back({r, q});
    } else if (col) {
      int c = v[i][0].second;
      int p = v[i][0].first;
      int q = v[i][v[i].size() - 1].first;
      for (int j = p; j <= q; j++) {
        if (second[j][c] < i + 'a') {
          cout << "NO" << endl;
          return;
        }
      }
      ans[i].push_back({p, c});
      ans[i].push_back({q, c});
    }
  }
  cout << "YES" << endl;
  cout << mx << endl;
  for (int i = 0; i < mx; i++) {
    cout << ans[i][0].first + 1 << ' ' << ans[i][0].second + 1 << ' '
         << ans[i][1].first + 1 << ' ' << ans[i][1].second + 1 << endl;
  }
}
int main() {
  {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
  };
  int t;
  cin >> t;
  while (t--) solve();
}
