#include <bits/stdc++.h>
using namespace std;
const int N = 3e3 + 105;
const int mod = 998244353;
const double Pi = acos(-1.0);
const long long INF = 1e18 + 1;
const int G = 3, Gi = 332748118;
long long qpow(long long a, long long b) {
  long long res = 1;
  while (b & 1) {
    if (b) res = (res * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return res;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
int n, m, T;
char s[N][N];
struct node {
  int sx, sy, ex, ey;
} sol[50];
vector<node> res;
int cnum[50];
int main() {
  scanf("%d", &T);
  while (T--) {
    scanf("%d%d", &n, &m);
    for (int i = 0; i <= 25; ++i) {
      sol[i].sx = 0;
      cnum[i] = 0;
    }
    res.clear();
    for (int i = 1; i <= n; ++i) {
      scanf("%s", s[i] + 1);
      for (int j = 1; j <= m; ++j) {
        if (s[i][j] == '.') continue;
        int tp = s[i][j] - 'a';
        cnum[tp]++;
        if (!sol[tp].sx) {
          sol[tp] = (node){i, j, i, j};
        }
      }
    }
    int flag = 0, num = 0;
    for (int z = 0; z <= 25; ++z) {
      int tp = (char)('a' + z);
      int x = sol[z].sx, y = sol[z].sy;
      if (!x) {
        num++;
        continue;
      }
      node e = (node){x, y, x, y};
      int tx = x, ty = y;
      int flag1 = 0, tnum = 0;
      while (tx <= n) {
        if (s[tx][y] == tp) {
          tnum++;
          if (flag1) {
            flag = 1;
            break;
          }
          e.ex = tx;
        } else if (s[tx][y] == '.' || s[tx][y] < tp)
          flag1 = 1;
        tx++;
      }
      if (flag) break;
      flag1 = 0;
      while (ty <= m) {
        if (s[x][ty] == tp) {
          tnum++;
          if (flag1) {
            flag = 1;
            break;
          }
          e.ey = ty;
        } else if (s[x][ty] == '.' || s[x][ty] < tp)
          flag1 = 1;
        ty++;
      }
      if (e.ex != x && e.ey != y)
        flag = 1;
      else if (tnum - 1 != cnum[z])
        flag = 1;
      if (flag) break;
      while (num) {
        res.push_back(e);
        num--;
      }
      res.push_back(e);
    }
    if (flag)
      printf("NO\n");
    else {
      printf("YES\n");
      int tt = res.size();
      printf("%d\n", tt);
      for (int i = 0; i < tt; ++i) {
        printf("%d %d %d %d\n", res[i].sx, res[i].sy, res[i].ex, res[i].ey);
      }
    }
  }
  return 0;
}
