#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  for (int test = 0; test < t; test++) {
    int n, M;
    cin >> n >> M;
    vector<vector<pair<int, int> > > v(26, vector<pair<int, int> >());
    map<pair<int, int>, int> m;
    char c;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < M; j++) {
        cin >> c;
        if (c != '.') {
          m[make_pair(i, j)] = (int)c - 'a';
          v[c - 'a'].emplace_back(i, j);
        }
      }
    }
    bool good = true;
    for (int i = 0; i < 26; i++) {
      if (v[i].size() > 1) {
        if (v[i][0].first == v[i][1].first) {
          for (int j = 1; j < v[i].size(); j++) {
            if (v[i][j].first != v[i][j - 1].first or
                v[i][j].second < v[i][j - 1].second) {
              good = false;
            } else {
              for (int from = v[i][j - 1].second; from <= v[i][j].second;
                   from++) {
                if (m.find(make_pair(v[i][j].first, from)) == m.end()) {
                  good = false;
                } else {
                  if (m[make_pair(v[i][j].first, from)] < i) {
                    good = false;
                  }
                }
              }
            }
          }
        } else {
          for (int j = 1; j < v[i].size(); j++) {
            if (v[i][j].second != v[i][j - 1].second or
                v[i][j].first < v[i][j - 1].first) {
              good = false;
            } else {
              for (int from = v[i][j - 1].first; from <= v[i][j].first;
                   from++) {
                if (m.find(make_pair(from, v[i][j].second)) == m.end()) {
                  good = false;
                } else {
                  if (m[make_pair(from, v[i][j].second)] < i) {
                    good = false;
                  }
                }
              }
            }
          }
        }
      }
    }
    int last = -1;
    for (int i = 0; i < 26; i++) {
      if (!v[i].empty()) {
        last = i;
      }
    }
    if (last == -1) {
      cout << "YES" << endl;
      cout << 0 << endl;
      continue;
    }
    if (good) {
      cout << "YES" << endl;
      cout << last + 1 << endl;
      for (int i = 0; i <= last; i++) {
        if (v[i].empty()) {
          cout << v[last][0].first + 1 << " " << v[last][0].second + 1 << " ";
          cout << v[last][0].first + 1 << " " << v[last][0].second + 1 << endl;
        } else {
          cout << v[i][0].first + 1 << " " << v[i][0].second + 1 << " ";
          cout << v[i][v[i].size() - 1].first + 1 << " "
               << v[i][v[i].size() - 1].second + 1 << endl;
        }
      }
    } else {
      cout << "NO" << endl;
    }
  }
  return 0;
}
