#include <bits/stdc++.h>
using namespace std;
int t;
vector<pair<int, int>> a[30], res[2];
string s[2005];
bool cmp1(pair<int, int> a, pair<int, int> b) {
  if (a.first != b.first) {
    return a.first < b.first;
  } else {
    return a.second < b.second;
  }
}
bool cmp2(pair<int, int> a, pair<int, int> b) {
  if (a.second == b.second) return a.first < b.first;
  return a.second < b.second;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> t;
  while (t--) {
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < 30; i++) {
      a[i].clear();
    }
    res[0].clear();
    res[1].clear();
    for (int i = 1; i <= n; i++) {
      cin >> s[i];
      for (int j = 0; j < s[i].size(); j++) {
        if (s[i][j] != '.') {
          a[s[i][j] - 'a'].push_back(make_pair(i, j + 1));
        }
      }
    }
    bool flag = 0;
    int mx;
    for (int i = 29; i >= 0; i--) {
      if (a[i].size()) {
        mx = i;
        flag = 1;
        break;
      }
    }
    if (!flag) {
      cout << "YES" << endl;
      cout << "0" << endl;
      continue;
    }
    flag = 1;
    for (int i = mx; i >= 0; i--) {
      if (a[i].size() == 0) {
        res[0].push_back(res[0][0]);
        res[1].push_back(res[1][0]);
        continue;
      }
      sort(a[i].begin(), a[i].end(), cmp1);
      if (a[i][0].first == a[i][a[i].size() - 1].first) {
        res[0].push_back(make_pair(a[i][0].first, a[i][0].second));
        res[1].push_back(make_pair(a[i][a[i].size() - 1].first,
                                   a[i][a[i].size() - 1].second));
      } else {
        sort(a[i].begin(), a[i].end(), cmp2);
        if (a[i][0].second == a[i][a[i].size() - 1].second) {
          res[0].push_back(make_pair(a[i][0].first, a[i][0].second));
          res[1].push_back(make_pair(a[i][a[i].size() - 1].first,
                                     a[i][a[i].size() - 1].second));
        } else {
          flag = 0;
          break;
        }
      }
      pair<int, int> x = res[0][res[0].size() - 1],
                     y = res[1][res[1].size() - 1];
      for (int j = min(x.first, y.first); j <= max(x.first, y.first); j++) {
        for (int k = min(x.second, y.second); k <= max(x.second, y.second);
             k++) {
          if ((s[j][k - 1] < 'a' + i) || (s[j][k - 1] == '.')) {
            flag = 0;
          }
        }
      }
      if (!flag) break;
    }
    if (!flag) {
      cout << "NO" << endl;
    } else {
      cout << "YES" << endl;
      cout << res[0].size() << endl;
      for (int i = res[0].size() - 1; i >= 0; i--) {
        cout << res[0][i].first << ' ' << res[0][i].second << ' '
             << res[1][i].first << ' ' << res[1][i].second << endl;
      }
    }
  }
  return 0;
}
