#include <bits/stdc++.h>
FILE *in = stdin;
FILE *out = stdout;
int n, m;
;
char board[2004][2004];
int main() {
  int i, j, k;
  int ts;
  fscanf(in, "%d", &ts);
  while (ts--) {
    int flag = 0;
    fscanf(in, "%d %d", &n, &m);
    for (i = 0; i < n; i++) {
      fscanf(in, "%s", board[i]);
    }
    int x[26][2], y[26][2];
    for (i = 0; i < 26; i++) {
      x[i][0] = -1;
      x[i][1] = -1;
      y[i][0] = -1;
      y[i][1] = -1;
    }
    int maxv = -1;
    for (k = 0; k < 26; k++) {
      for (i = 0; i < n; i++) {
        for (j = 0; j < m; j++) {
          if (board[i][j] == 'a' + k) {
            if (x[k][0] == -1) {
              x[k][0] = i;
              x[k][1] = i;
              y[k][0] = j;
              y[k][1] = j;
            } else {
              if (x[k][0] > i) {
                x[k][0] = i;
              }
              if (x[k][1] < i) {
                x[k][1] = i;
              }
              if (y[k][0] > j) {
                y[k][0] = j;
              }
              if (y[k][1] < j) {
                y[k][1] = j;
              }
            }
          }
        }
      }
      if (x[k][0] == -1) continue;
      if (x[k][0] == x[k][1]) {
        i = x[k][0];
        for (j = y[k][0]; j <= y[k][1]; j++) {
          if (board[i][j] < 'a' + k || board[i][j] == '.') {
            flag = 1;
            break;
          }
        }
        maxv = k;
      } else if (y[k][0] == y[k][1]) {
        j = y[k][0];
        for (i = x[k][0]; i <= x[k][1]; i++) {
          if (board[i][j] < 'a' + k || board[i][j] == '.') {
            flag = 1;
            break;
          }
        }
        maxv = k;
      } else {
        flag = 1;
      }
    }
    if (flag == 1) {
      fprintf(out, "NO\n");
    } else {
      fprintf(out, "YES\n");
      i = maxv + 1;
      fprintf(out, "%d\n", i);
      for (j = 0; j < i; j++) {
        if (x[j][0] == -1) {
          fprintf(out, "%d %d %d %d\n", x[i - 1][0] + 1, y[i - 1][0] + 1,
                  x[i - 1][1] + 1, y[i - 1][1] + 1);
        } else
          fprintf(out, "%d %d %d %d\n", x[j][0] + 1, y[j][0] + 1, x[j][1] + 1,
                  y[j][1] + 1);
      }
    }
  }
  return 0;
}
