#include <bits/stdc++.h>
using namespace std;
const int MAX = 2005;
int n, m;
char str[MAX][MAX];
vector<pair<int, int> > v[30];
vector<pair<pair<int, int>, pair<int, int> > > ans;
inline bool check(char c) {
  if (v[c - 'a'].empty()) {
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        if (str[i][j] == '.') continue;
        if (str[i][j] > c) {
          ans.push_back({{i, j}, {i, j}});
          return true;
        }
      }
    }
    assert(false);
  }
  int mnR = INT_MAX, mxR = INT_MIN;
  int mnC = INT_MAX, mxC = INT_MIN;
  for (auto &x : v[c - 'a']) {
    mnR = min(mnR, x.first);
    mxR = max(mxR, x.first);
    mnC = min(mnC, x.second);
    mxC = max(mxC, x.second);
  }
  if (mnR == mxR) {
    for (int j = mnC; j <= mxC; j++) {
      if (str[mnR][j] == '.') return false;
      if (str[mnR][j] >= c) continue;
      return false;
    }
    ans.push_back({{mnR, mnC}, {mxR, mxC}});
    return true;
  } else if (mnC == mxC) {
    for (int i = mnR; i <= mxR; i++) {
      if (str[i][mnC] == '.') return false;
      if (str[i][mnC] >= c) continue;
      return false;
    }
    ans.push_back({{mnR, mnC}, {mxR, mxC}});
    return true;
  } else
    return false;
}
void solve() {
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (str[i][j] == '.') continue;
      v[str[i][j] - 'a'].push_back({i, j});
    }
  }
  char bound = '.';
  for (char c = 'a'; c <= 'z'; c++) {
    if (!v[c - 'a'].empty()) bound = c;
  }
  if (bound == '.') {
    puts("YES");
    puts("0");
    return;
  }
  for (char c = 'a'; c <= bound; c++) {
    if (!check(c)) {
      puts("NO");
      return;
    }
  }
  puts("YES");
  printf("%d\n", (int)ans.size());
  for (auto &x : ans) {
    printf("%d %d %d %d\n", x.first.first + 1, x.first.second + 1,
           x.second.first + 1, x.second.second + 1);
  }
}
int main() {
  int test;
  scanf("%d", &test);
  while (test--) {
    scanf("%d %d", &n, &m);
    for (int i = 0; i < n; i++) scanf("%s", str[i]);
    solve();
    ans.clear();
    for (int i = 0; i < 26; i++) v[i].clear();
  }
  return 0;
}
