#include <bits/stdc++.h>
using namespace std;
struct node {
  int x, y;
  bool operator==(const node& o) const { return x == o.x && y == o.y; }
  bool operator!=(const node& o) const { return x != o.x || y != o.y; }
};
int n, m;
char g[(2020)][(2020)];
bool vis[(2020)][(2020)], exist[26];
node ans[26][2];
bool findx(int x, int y, char c, node& p, node& q) {
  bool ok = true, nomore = false;
  p.x = q.x = x;
  p.y = q.y = y;
  for (int i = 1, f = 0; i <= n; i++) {
    if (g[i][y] == c) {
      if (!f) {
        p.x = i;
        f = 1;
      }
      q.x = i;
      vis[i][y] = true;
      if (nomore) {
        return false;
      }
    } else if (g[i][y] == '.' || g[i][y] < c) {
      if (f && nomore == false) {
        nomore = true;
      }
    }
  }
  return true;
}
bool findy(int x, int y, char c, node& p, node& q) {
  bool ok = true, nomore = false;
  p.x = q.x = x;
  p.y = q.y = y;
  for (int i = 1, f = 0; i <= m; i++) {
    if (g[x][i] == c) {
      if (!f) {
        p.y = i;
        f = 1;
      }
      q.y = i;
      vis[x][i] = true;
      if (nomore) {
        return false;
      }
    } else if (g[x][i] == '.' || g[x][i] < c) {
      if (f && nomore == false) {
        nomore = true;
      }
    }
  }
  return true;
}
void init() {
  cin >> n >> m;
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= m; j++) vis[i][j] = false;
  memset(exist, 0, sizeof(exist));
  for (int i = 1; i <= n; i++) scanf("%s", g[i] + 1);
}
int main() {
  int T;
  cin >> T;
  while (T--) {
    init();
    int cnt = -1;
    bool ok = true;
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= m; j++)
        if (!vis[i][j]) {
          if (g[i][j] == '.') continue;
          if (exist[g[i][j] - 'a']) {
            ok = false;
            break;
          }
          node p1, q1;
          if (!findx(i, j, g[i][j], p1, q1)) {
            ok = false;
            break;
          }
          node p2, q2;
          if (!findy(i, j, g[i][j], p2, q2)) {
            ok = false;
            break;
          }
          if (p1 != q1 && p2 != q2) {
            ok = false;
            break;
          }
          if (p1 == q1) {
            ans[g[i][j] - 'a'][0] = p2;
            ans[g[i][j] - 'a'][1] = q2;
          } else {
            ans[g[i][j] - 'a'][0] = p1;
            ans[g[i][j] - 'a'][1] = q1;
          }
          cnt = max(cnt, g[i][j] - 'a');
          exist[g[i][j] - 'a'] = true;
        }
    }
    if (!ok) {
      printf("NO\n");
      continue;
    }
    printf("YES\n%d\n", cnt + 1);
    for (int i = 0, k = 0; i <= cnt; i++) {
      if (!exist[i]) {
        k++;
        continue;
      }
      for (int j = 0; j < k + 1; j++) {
        printf("%d %d %d %d\n", ans[i][0].x, ans[i][0].y, ans[i][1].x,
               ans[i][1].y);
      }
      k = 0;
    }
  }
  return 0;
}
