#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, m;
    cin >> n >> m;
    vector<string> G(n);
    for (int i = 0; i < n; i++) {
      cin >> G[i];
    }
    vector<vector<pair<int, int>>> arr(27, vector<pair<int, int>>());
    bool ret_flag = false;
    bool empty_flag = true;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        if (G[i][j] == '.') continue;
        empty_flag = false;
        auto temp = G[i][j] - 'a';
        if (arr[temp].size() == 1 &&
            !(arr[temp][0].first == i || arr[temp][0].second == j)) {
          ret_flag = true;
          break;
        } else if (arr[temp].size() > 1 &&
                   !((arr[temp][0].first == i &&
                      arr[temp][arr[temp].size() - 1].first == i) ||
                     (arr[temp][0].second == j &&
                      arr[temp][arr[temp].size() - 1].second == j))) {
          ret_flag = true;
          break;
        }
        arr[temp].push_back(make_pair(i, j));
      }
      if (ret_flag) break;
    }
    if (empty_flag) {
      cout << "YES" << endl;
      cout << 0 << endl;
      continue;
    }
    if (ret_flag) {
      cout << "NO" << endl;
      continue;
    }
    int max_snake = 0;
    for (int i = 25; i >= 0; i--) {
      if (arr[i].size() == 0) continue;
      max_snake = max(max_snake, i);
      if (arr[i][0].first == arr[i][arr[i].size() - 1].first) {
        int r = arr[i][0].first;
        for (int j = arr[i][0].second; j <= arr[i][arr[i].size() - 1].second;
             j++) {
          if (G[r][j] - 'a' >= i) continue;
          ret_flag = true;
          break;
        }
        if (ret_flag) break;
      } else if (arr[i][0].second == arr[i][arr[i].size() - 1].second) {
        int c = arr[i][0].second;
        for (int j = arr[i][0].first; j <= arr[i][arr[i].size() - 1].first;
             j++) {
          if (G[j][c] >= 'a' + i) continue;
          ret_flag = true;
          break;
        }
        if (ret_flag) break;
      }
      if (ret_flag) break;
    }
    if (ret_flag) {
      cout << "NO" << endl;
      continue;
    }
    cout << "YES" << endl;
    cout << max_snake + 1 << endl;
    for (int i = 0; i <= 25; i++) {
      int j = i;
      if (arr[i].empty()) {
        while (i < 26 && arr[i].empty()) i++;
      }
      if (i == 26) break;
      cout << arr[i][0].first + 1 << " " << arr[i][0].second + 1 << " "
           << arr[i].back().first + 1 << " " << arr[i].back().second + 1
           << endl;
      i = j;
    }
  }
  return 0;
}
