#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e3 + 9;
char mp[maxn][maxn];
pair<int, int> lst[300];
map<char, int> tot;
int nxt[4][2] = {0, 1, 1, 0, 0, -1, -1, 0};
int n, m;
bool judge(int x, int y) {
  if (x >= 1 && y >= 1 && x <= n && y <= m) return true;
  return false;
}
struct node {
  int x1, y1, x2, y2;
} ans[27];
bool check(int sx, int sy) {
  for (int i = 0; i < 4; i++) {
    int tx, ty;
    tx = sx + nxt[i][0];
    ty = sy + nxt[i][1];
    int cnt = 1;
    while (judge(tx, ty) && mp[tx][ty] >= mp[sx][sy] && mp[tx][ty] != '.') {
      if (mp[tx][ty] == mp[sx][sy]) {
        cnt++;
        mp[tx][ty] = '.';
      }
      tx += nxt[i][0];
      ty += nxt[i][1];
    }
    if (cnt == tot[mp[sx][sy]]) {
      ans[mp[sx][sy] - 'a'] = {tx - nxt[i][0], ty - nxt[i][1], sx, sy};
      mp[sx][sy] = '.';
      return true;
      ;
    }
  }
  return false;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int i, j, k, t;
  cin >> t;
  while (t--) {
    cin >> n >> m;
    int sum = 0;
    memset(ans, 0, sizeof(ans));
    memset(lst, 0, sizeof(lst));
    for (i = 'a'; i <= 'z'; i++) {
      tot[i] = 0;
    }
    for (i = 1; i <= n; i++) {
      for (j = 1; j <= m; j++) {
        cin >> mp[i][j];
        if (mp[i][j] != '.') {
          lst[mp[i][j]] = make_pair(i, j);
          sum = max(sum, (int)mp[i][j]);
          tot[mp[i][j]]++;
        }
      }
    }
    for (i = 'a'; i <= 'z'; i++) {
      check(lst[i].first, lst[i].second);
    }
    for (i = 'z' - 1; i >= 'a'; i--) {
      if (lst[i].first == 0 && lst[i].second == 0) {
        ans[i - 'a'] = ans[i - 'a' + 1];
      }
    }
    int flag = 0;
    if (sum >= 'a')
      sum -= 'a' - 1;
    else
      sum = 0;
    for (i = 1; i <= n; i++) {
      for (j = 1; j <= m; j++) {
        if (mp[i][j] != '.') {
          flag = 1;
          break;
        }
      }
    }
    if (flag) {
      cout << "NO" << endl;
    } else {
      cout << "YES" << endl;
      cout << sum << endl;
      for (int i = 'a'; i <= 'z'; i++) {
        if (ans[i - 'a'].x1 != 0)
          cout << ans[i - 'a'].x1 << " " << ans[i - 'a'].y1 << " "
               << ans[i - 'a'].x2 << " " << ans[i - 'a'].y2 << endl;
      }
    }
  }
}
