#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int MAXN = 2010;
char grid[MAXN][MAXN];
int T, R, S;
set<int> row[27], col[27];
inline void init() {
  for (int i = 0; i < 26; ++i) {
    row[i].clear();
    col[i].clear();
  }
}
void solve() {
  scanf("%d%d", &R, &S);
  for (int i = 0; i < R; ++i) scanf("%s", grid[i]);
  init();
  for (int i = 0; i < R; ++i) {
    for (int j = 0; j < S; ++j) {
      if (grid[i][j] == '.') continue;
      row[grid[i][j] - 'a'].insert(i);
      col[grid[i][j] - 'a'].insert(j);
    }
  }
  int cnt = 0;
  int R1, R2, S1, S2;
  for (int i = 0; i < 26; ++i) {
    if (row[i].size() == 0) continue;
    cnt = i + 1;
    if (row[i].size() > 1 && col[i].size() > 1) {
      printf("NO\n");
      return;
    }
    int r1 = *(row[i].begin()), r2 = *(row[i].rbegin());
    int s1 = *(col[i].begin()), s2 = *(col[i].rbegin());
    R1 = r1;
    R2 = r2;
    S1 = s1;
    S2 = s2;
    for (int ii = r1; ii <= r2; ++ii) {
      for (int jj = s1; jj <= s2; ++jj) {
        if (grid[ii][jj] - 'a' < i) {
          printf("NO\n");
          return;
        }
      }
    }
  }
  printf("YES\n");
  printf("%d\n", cnt);
  for (int i = 0; i < cnt; ++i) {
    if (row[i].size() == 0) {
      printf("%d %d %d %d\n", R1 + 1, S1 + 1, R2 + 1, S2 + 1);
      continue;
    }
    int r1 = *(row[i].begin()), r2 = *(row[i].rbegin());
    int s1 = *(col[i].begin()), s2 = *(col[i].rbegin());
    printf("%d %d %d %d\n", r1 + 1, s1 + 1, r2 + 1, s2 + 1);
  }
}
int main(void) {
  scanf("%d", &T);
  while (T-- > 0) solve();
  return 0;
}
