#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-ffloat-store")
#pragma GCC optimize("-fno-defer-pop")
long long int power(long long int a, long long int b, long long int m) {
  if (b == 0) return 1;
  if (b == 1) return a % m;
  long long int t = power(a, b / 2, m) % m;
  t = (t * t) % m;
  if (b & 1) t = ((t % m) * (a % m)) % m;
  return t;
}
long long int modInverse(long long int a, long long int m) {
  return power(a, m - 2, m);
}
bool comp(const pair<long long int, long long int>& a,
          const pair<long long int, long long int>& b) {
  if (a.first < b.first)
    return true;
  else if (a.first == b.first) {
    if (a.second < b.second)
      return true;
    else
      return false;
  } else
    return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    long long int i, j, k, l, n, m;
    cin >> n >> m;
    char ar[n][m + 1];
    vector<pair<long long int, long long int> > vc[26];
    long long int extt = 0, ctc = 0;
    for (i = 0; i < n; i++) {
      cin >> ar[i];
      for (j = 0; j < m; j++) {
        if (ar[i][j] == '.') {
        } else {
          vc[(ar[i][j] - 'a')].push_back({i, j});
        }
      }
    }
    long long int flag = 1, x1 = 0, x2 = 0, y1 = 0, y2 = 0;
    for (i = 0; i < 26; i++) {
      if (vc[i].size() > 0) {
        extt++;
        x1 = vc[i][0].first;
        y1 = vc[i][0].second;
        x2 = vc[i][0].first;
        y2 = vc[i][0].second;
      }
    }
    vector<pair<pair<long long int, long long int>,
                pair<long long int, long long int> > >
        an;
    for (i = 0; i < 26; i++) {
      if (vc[i].size() == 0) {
        if (ctc < extt) an.push_back({{x1, y1}, {x2, y2}});
        continue;
      }
      sort(vc[i].begin(), vc[i].end(), comp);
      ctc++;
      if (vc[i].size() == 1) {
        an.push_back({{vc[i][0].first, vc[i][0].second},
                      {vc[i][0].first, vc[i][0].second}});
      } else {
        if (vc[i][0].first != vc[i][1].first) {
          for (j = 1; j < vc[i].size(); j++) {
            if (vc[i][j].second != vc[i][j - 1].second) {
              flag = 0;
              break;
            }
          }
          if (!flag) break;
          for (j = vc[i][0].first; j <= vc[i][vc[i].size() - 1].first; j++) {
            if (ar[j][vc[i][0].second] - 'a' < i) {
              flag = 0;
              break;
            }
          }
          if (!flag) break;
          an.push_back({{vc[i][0].first, vc[i][0].second},
                        {vc[i][vc[i].size() - 1].first, vc[i][0].second}});
        } else {
          for (j = 1; j < vc[i].size(); j++) {
            if (vc[i][j].first != vc[i][j - 1].first) {
              flag = 0;
              break;
            }
          }
          if (!flag) break;
          for (j = vc[i][0].second; j <= vc[i][vc[i].size() - 1].second; j++) {
            if (ar[vc[i][0].first][j] - 'a' < i) {
              flag = 0;
              break;
            }
          }
          if (!flag) break;
          an.push_back({{vc[i][0].first, vc[i][0].second},
                        {vc[i][0].first, vc[i][vc[i].size() - 1].second}});
        }
      }
    }
    if (!flag) {
      cout << "NO\n";
    } else {
      cout << "YES\n";
      cout << an.size() << "\n";
      for (i = 0; i < an.size(); i++) {
        cout << an[i].first.first + 1 << " " << an[i].first.second + 1 << " ";
        cout << an[i].second.first + 1 << " " << an[i].second.second + 1
             << "\n";
      }
    }
  }
  return 0;
}
