#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;


int main() {
  cin.tie(nullptr); ios_base::sync_with_stdio(false);
  int q; cin >> q;
  while (q--) {
    int h, w; cin >> h >> w;
    V<string> s(h);
    for (auto&& e : s) cin >> e;
    V<> idx;
    for (int i = 0; i < h; ++i) for (int j = 0; j < w; ++j) {
      if (s[i][j] != '.') {
        idx.push_back(s[i][j] - 'A');
      }
    }
    sort(begin(idx), end(idx));
    idx.erase(unique(begin(idx), end(idx)), end(idx));
    int n = idx.size();
    V<> il(26, h), ir(26, -1), jl(26, w), jr(26, -1);
    for (int i = 0; i < h; ++i) for (int j = 0; j < w; ++j) if (s[i][j] != '.') {
      int x = s[i][j] - 'A';
      il[x] = min(il[x], i);
      ir[x] = max(ir[x], i);
      jl[x] = min(jl[x], j);
      jr[x] = max(jr[x], j);
    }
    bool safe = [&] {
      do {
        V<string> t(h, string(w, '.'));
        for (int k = 0; k < n; ++k) {
          for (int i = il[idx[k]]; i <= ir[idx[k]]; ++i) for (int j = jl[idx[k]]; j <= jr[idx[k]]; ++j) {
            t[i][j] = 'A' + idx[k];
          }
        }
        if (s == t) return true;
      } while (next_permutation(begin(idx), end(idx)));
      return false;
    }();
    cout << (safe ? "SAFE\n" : "SUSPICIOUS\n");
  }
}
