#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long T = 1;
  cin >> T;
  while (T--) {
    long long n, m;
    cin >> n >> m;
    char v[n][m];
    for (long long i = 0; i < n; i++) {
      for (long long j = 0; j < m; j++) {
        cin >> v[i][j];
      }
    }
    vector<pair<pair<long long, long long>, pair<long long, long long> > > ans;
    long long flag = 0, temp = 0;
    for (long long k = 0; k < 26; k++) {
      temp = 0;
      for (long long i = 0; i < n; i++) {
        for (long long j = 0; j < m; j++) {
          if (v[i][j] == 'a' + k) {
            long long f1 = 0, f2 = 0;
            long long x = i, y = j;
            for (long long t = n - 1; t > i; t--) {
              if (v[t][j] == 'a' + k) {
                x = t;
                y = j;
                f1 = 1;
                break;
              }
            }
            for (long long t = m - 1; t > j; t--) {
              if (v[i][t] == 'a' + k) {
                x = i;
                y = t;
                f2 = 1;
                break;
              }
            }
            if (f1 && f2) {
              flag = 1;
              break;
            }
            while (ans.size() != k + 1) {
              ans.push_back(make_pair(make_pair(i, j), make_pair(x, y)));
            }
            temp = 1;
            break;
          }
        }
        if (flag || temp) break;
      }
      if (flag) break;
    }
    if (flag) {
      cout << "NO" << endl;
      continue;
    }
    char fin[n][m];
    for (long long i = 0; i < n; i++) {
      for (long long j = 0; j < m; j++) fin[i][j] = '.';
    }
    for (long long k = 0; k < ans.size(); k++) {
      for (long long i = ans[k].first.first; i < ans[k].second.first + 1; i++) {
        for (long long j = ans[k].first.second; j < ans[k].second.second + 1;
             j++) {
          fin[i][j] = 'a' + k;
        }
      }
    }
    for (long long i = 0; i < n; i++) {
      for (long long j = 0; j < m; j++) {
        if (fin[i][j] != v[i][j]) {
          flag = 1;
          break;
        }
      }
    }
    if (!flag) {
      cout << "YES" << endl << ans.size() << endl;
      for (long long i = 0; i < ans.size(); i++) {
        cout << ans[i].first.first + 1 << " " << ans[i].first.second + 1 << " "
             << ans[i].second.first + 1 << " " << ans[i].second.second + 1
             << endl;
      }
    } else {
      cout << "NO" << endl;
    }
  }
  return 0;
}
