#include <bits/stdc++.h>
using namespace std;
int main(int argc, char **argv) {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n, m, k, fl = 0;
    cin >> n >> m;
    vector<pair<int, int> > pos[26];
    int v[n][m];
    set<int> cnt[2][26];
    for (int i = 0; i < n; i++)
      for (int j = 0; j < m; j++) {
        char x;
        cin >> x;
        if (x == '.') {
          v[i][j] = -1;
          continue;
        }
        v[i][j] = x - 'a';
        pos[x - 'a'].push_back({i, j}), cnt[0][x - 'a'].insert(i),
            cnt[1][x - 'a'].insert(j);
      }
    for (k = 25; k >= 0 && pos[k].empty(); k--)
      ;
    vector<pair<pair<int, int>, pair<int, int> > > ans(k + 1,
                                                       {{-1, -1}, {-1, -1}});
    for (int i = 0; i <= k && !fl; i++) {
      if (cnt[0][i].size() > 1 && cnt[1][i].size() > 1) {
        fl = 1;
        break;
      }
      if (pos[i].empty()) continue;
      sort(pos[i].begin(), pos[i].end());
      pair<int, int> st = pos[i][0], en = pos[i].back(),
                     di = {en.first - st.first, en.second - st.second};
      ans[i].first = st, ans[i].second = en;
      if (pos[i].size() == 1) continue;
      for (; st <= en && !fl; st.first += !!di.first, st.second += !!di.second)
        if (v[st.first][st.second] < i) fl = 1;
    }
    if (fl)
      cout << "NO" << endl;
    else {
      cout << "YES" << endl;
      cout << k + 1 << endl;
      for (int i = 0; i < k + 1; i++) {
        if (ans[i].first.first == -1) ans[i] = ans[k];
        cout << ans[i].first.first + 1 << " " << ans[i].first.second + 1 << " "
             << ans[i].second.first + 1 << " " << ans[i].second.second + 1
             << endl;
      }
    }
  }
}
