#include <bits/stdc++.h>
using namespace std;
template <class T>
ostream& operator<<(ostream& os, vector<T> V) {
  os << "[ ";
  for (auto v : V) os << v << " ";
  return os << "]";
}
template <class L, class R>
ostream& operator<<(ostream& os, pair<L, R> P) {
  return os << "(" << P.first << "," << P.second << ")";
}
const long long Mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n, m;
    cin >> n >> m;
    string A[n];
    bool q = true;
    for (int i = 0; i < n; i++) cin >> A[i];
    int dp[4][26];
    for (int i = 0; i < 2; i++) {
      for (int j = 0; j < 26; j++) dp[i][j] = Mod;
    }
    for (int i = 2; i < 4; i++) {
      for (int j = 0; j < 26; j++) dp[i][j] = -1;
    }
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        if (A[i][j] != '.') {
          dp[0][A[i][j] - 'a'] = min(dp[0][A[i][j] - 'a'], i);
          dp[1][A[i][j] - 'a'] = min(dp[1][A[i][j] - 'a'], j);
          dp[2][A[i][j] - 'a'] = max(dp[2][A[i][j] - 'a'], i);
          dp[3][A[i][j] - 'a'] = max(dp[3][A[i][j] - 'a'], j);
        }
      }
    }
    for (int i = 0; i < 26; i++) {
      if (dp[0][i] != Mod) {
        if ((dp[0][i] != dp[2][i]) && (dp[1][i] != dp[3][i])) {
          q = false;
        }
      }
    }
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        if (A[i][j] != '.') {
          for (char c = A[i][j] + 1; c <= 'z'; c++) {
            if ((dp[0][c - 'a'] <= i) && (dp[2][c - 'a'] >= i) &&
                (dp[1][c - 'a'] <= j) && (dp[3][c - 'a'] >= j)) {
              q = false;
            }
          }
        } else {
          for (char c = 'a'; c <= 'z'; c++) {
            if ((dp[0][c - 'a'] <= i) && (dp[2][c - 'a'] >= i) &&
                (dp[1][c - 'a'] <= j) && (dp[3][c - 'a'] >= j)) {
              q = false;
            }
          }
        }
      }
    }
    if (!q) {
      cout << "NO" << endl;
      continue;
    }
    int mx = -1;
    for (int i = 0; i < 26; i++) {
      if (dp[0][i] != Mod) mx = i;
    }
    cout << "YES" << endl;
    cout << mx + 1 << endl;
    vector<pair<pair<int, int>, pair<int, int> > > ans;
    int a, b, c, d;
    if (mx == -1) continue;
    a = dp[0][mx], b = dp[1][mx], c = dp[2][mx], d = dp[3][mx];
    for (int i = mx; i >= 0; i--) {
      if (dp[0][i] != Mod) {
        a = dp[0][i], b = dp[1][i], c = dp[2][i], d = dp[3][i];
        ans.push_back(make_pair((make_pair((a), (b))), (make_pair((c), (d)))));
      } else
        ans.push_back(make_pair((make_pair((a), (b))), (make_pair((c), (d)))));
    }
    reverse((ans).begin(), (ans).end());
    for (auto it : ans)
      cout << it.first.first + 1 << " " << it.first.second + 1 << " "
           << it.second.first + 1 << " " << it.second.second + 1 << endl;
  }
  return 0;
}
