#include <bits/stdc++.h>
using namespace std;
const int64_t M1 = 998244353;
const int64_t M2 = 1000000007;
void solve() {
  int64_t n, m;
  cin >> n >> m;
  string s[n];
  vector<pair<int64_t, int64_t>> mp[26];
  vector<pair<int64_t, int64_t>> ans;
  for (int64_t i = 0; i < n; i++) {
    cin >> s[i];
    for (int64_t j = 0; j < m; j++)
      if (s[i][j] >= 'a' && s[i][j] <= 'z') mp[s[i][j] - 'a'].push_back({i, j});
  }
  for (int64_t i = 0; i < 26; i++) sort(mp[i].begin(), mp[i].end());
  for (int64_t i = 0; i < 26; i++) {
    if (mp[i].empty()) {
      for (int64_t j = i + 1; j < 26; j++) {
        if (!mp[j].empty()) {
          ans.push_back({mp[j][0].first, mp[j][0].second});
          ans.push_back({mp[j][0].first, mp[j][0].second});
          break;
        }
      }
    } else if (mp[i].size() == 1) {
      ans.push_back({mp[i][0].first, mp[i][0].second});
      ans.push_back({mp[i][0].first, mp[i][0].second});
    } else {
      if (mp[i][0].second == mp[i][1].second) {
        int64_t l = 0;
        int64_t x = mp[i][0].first, y = mp[i][0].second;
        while (l < mp[i].size() && x < n) {
          if (mp[i][l].first == x && mp[i][l].second == y)
            l++;
          else {
            if (s[x][y] - 'a' < i) {
              cout << "NO\n";
              return;
            }
          }
          x++;
        }
        if (l < mp[i].size()) {
          cout << "NO\n";
          return;
        }
      } else if (mp[i][0].first == mp[i][1].first) {
        int64_t l = 0;
        int64_t x = mp[i][0].first, y = mp[i][0].second;
        while (l < mp[i].size() && y < m) {
          if (mp[i][l].first == x && mp[i][l].second == y)
            l++;
          else {
            if (s[x][y] - 'a' < i) {
              cout << "NO\n";
              return;
            }
          }
          y++;
        }
        if (l < mp[i].size()) {
          cout << "NO\n";
          return;
        }
      } else {
        cout << "NO\n";
        return;
      }
      ans.push_back({mp[i][0].first, mp[i][0].second});
      ans.push_back({mp[i].back().first, mp[i].back().second});
    }
  }
  cout << "YES\n";
  cout << (ans.size() / 2) << "\n";
  for (int64_t i = 0; i < ans.size(); i += 2) {
    cout << ans[i].first + 1 << " " << ans[i].second + 1 << " ";
    cout << ans[i + 1].first + 1 << " " << ans[i + 1].second + 1 << "\n";
  }
}
int32_t main() {
  int64_t t;
  cin >> t;
  while (t--) solve();
}
