#include <bits/stdc++.h>
using namespace std;
long long int n, m;
string s[2009];
string ans[2009];
pair<long long int, long long int> first[26];
pair<long long int, long long int> last[26];
string cmp[2009];
void init() {
  for (long long int i = 0; i < 26; i++) {
    first[i] = make_pair(-1, -1);
    last[i] = make_pair(-1, -1);
  }
}
bool check() {
  bool is = 0;
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j < m; j++) {
      if (s[i][j] != cmp[i][j]) is = 1;
    }
  }
  return is;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int t;
  cin >> t;
  while (t--) {
    char maxi = 'a' - 1;
    cin >> n >> m;
    init();
    for (long long int i = 0; i < n; i++) {
      cin >> s[i];
      for (long long int j = 0; j < m; j++) {
        if (first[s[i][j] - 'a'].first == -1) {
          first[s[i][j] - 'a'] = make_pair(i, j);
          last[s[i][j] - 'a'] = make_pair(i, j);
        } else {
          last[s[i][j] - 'a'] = make_pair(i, j);
        }
        if (s[i][j] != '.') {
          if (s[i][j] > maxi) maxi = s[i][j];
        }
      }
    }
    for (long long int i = 0; i < n; i++) {
      cmp[i] = "";
      for (long long int j = 0; j < m; j++) {
        cmp[i] += '.';
      }
    }
    for (long long int i = 0; i < 26; i++) {
      if (first[i].first != -1) {
        if (first[i].first == last[i].first) {
          for (long long int j = first[i].second; j <= last[i].second; j++) {
            cmp[first[i].first][j] = 'a' + i;
          }
        } else {
          for (long long int j = first[i].first; j <= last[i].first; j++) {
            cmp[j][first[i].second] = 'a' + i;
          }
        }
      }
    }
    if (check()) {
      cout << "NO\n";
      continue;
    }
    cout << "YES\n";
    cout << (maxi - 'a' + 1) << "\n";
    for (long long int i = 0; i < (maxi - 'a' + 1); i++) {
      if (first[i].first == -1) {
        cout << first[maxi - 'a'].first + 1 << " "
             << first[maxi - 'a'].second + 1 << " "
             << last[maxi - 'a'].first + 1 << " " << last[maxi - 'a'].second + 1
             << "\n";
      } else {
        cout << first[i].first + 1 << " " << first[i].second + 1 << " "
             << last[i].first + 1 << " " << last[i].second + 1 << "\n";
      }
    }
  }
}
