#include <bits/stdc++.h>

using namespace std;

#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<(n);++i)
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(int)(n);i>=0;--i)
#define RFOR(i, a, b) for(int i=(int)(a);i>=(int)(b);--i)
#define ALL(a) (a).begin(),(a).end()
#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;

const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;

template <typename T1, typename T2>
bool chmax(T1 &a, const T2 &b) {
  if(a < b) {a = b; return true;}
  return false;
}

template <typename T1, typename T2>
bool chmin(T1 &a, const T2 &b) {
  if(a > b) {a = b; return true;}
  return false;
}

template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}

template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  REP(i, SZ(v)) {
    if(i) os << " ";
    os << v[i];
  }
  return os;
}

class Scc {
  using Graph = std::vector<std::vector<int>>;
  int V, K;
  Graph G, rG;
  std::vector<int> vs;
  std::vector<bool> used;
  std::vector<int> cmp;
  void dfs(int cur) {
    used[cur] = true;
    for (const auto &v : G[cur]) {
      if (!used[v]) dfs(v);
    }
    vs.push_back(cur);
  }
  void rdfs(int cur, int k) {
    used[cur] = true;
    cmp[cur] = k;
    for (const auto &v : rG[cur]) {
      if (!used[v]) rdfs(v, k);
    }
  }

public:
  Scc(int _V) : V(_V), G(_V), rG(_V), used(_V, false), cmp(_V) {}
  void add_edge(int from, int to) {
    G[from].push_back(to);
    rG[to].push_back(from);
  }
  // SCCした後の頂点の対応関係(xor頂点数)を取得する
  std::vector<int> scc() {
    for (int i = 0; i < V; i++) used[i] = false;
    vs.clear();
    for (int v = 0; v < V; v++) {
      if (!used[v]) dfs(v);
    }
    for (int i = 0; i < V; i++) used[i] = false;
    int k = 0;
    for (int i = (int)vs.size() - 1; i >= 0; i--) {
      if (!used[vs[i]]) rdfs(vs[i], k++);
    }
    // 頂点数
    K = k;
    // cmp[i] := 頂点i がSCC後に属する強連結成分番号
    return cmp;
  }
  // 強連結成分を潰した後のグラフを得る
  Graph buildGraph() {
    scc();
    std::vector<std::set<int>> s(K);
    Graph ret(K);
    for (int v = 0; v < V; v++) {
      for (const auto to : G[v]) {
        s[cmp[v]].insert(cmp[to]);
      }
    }
    for (int i = 0; i < K; i++) {
      for (auto j : s[i]) {
        if (i != j) ret[i].push_back(j);
      }
    }
    return ret;
  }
};

struct Rect {
  int rmi=INF, rma=0, cmi=INF, cma=0;
};

void solve() {
  int h, w; cin >> h >> w;
  vector<string> v;
  REP(i, h) {
    string tmp; cin >> tmp;
    v.push_back(tmp);
  }

  map<char, Rect> mp;
  map<char, int> zatu;
  int id = 1;
  REP(i, h) {
    REP(j, w) {
      if(v[i][j] == '.') continue;
      if(zatu[v[i][j]] == 0) {
        zatu[v[i][j]] = id;
        id++;
      }
      auto &e = mp[v[i][j]];
      chmin(e.rmi, i);
      chmax(e.rma, i);
      chmin(e.cmi, j);
      chmax(e.cma, j);
    }
  }

  bool ok = true;

  vector<set<int>> g(id-1);
  REP(i, h) {
    if(!ok) break;
    REP(j, w) {
      if(v[i][j] == '.') {
        for (auto &e: mp) {
          auto rec = e.second;
          if(rec.rmi <= i && i <= rec.rma &&
             rec.cmi <= j && j <= rec.cma) {
            ok = false;
            break;
          }
        }
      } else {
        for(auto &e: mp) {
          if(e.first == v[i][j]) continue;
          auto rec = e.second;
          if(rec.rmi <= i && i <= rec.rma &&
             rec.cmi <= j && j <= rec.cma) {
            g[zatu[v[i][j]]-1].insert(zatu[e.first]-1);
          }
        }
      }
    }
  }
/*
  for(auto &e: mp) {
    cout << e.first << endl;
    cout << e.second.rmi << " " << e.second.rma << " " << e.second.cmi << " " << e.second.cma << endl;
  }

  REP(i, SZ(zatu)) {
    cout << i << ":";
    for(auto &e: g[i]) {
      cout << e << " ";
    }
    cout << endl;
  }
  */

  Scc scc(id-1);
  REP(i, id-1) {
    for(auto &e: g[i]) {
      scc.add_edge(i, e);
    }
  }

  vi tmp = scc.scc();
  map<int, int> cnt;
  REP(i, id-1) {
    cnt[tmp[i]]++;
  }
  if(SZ(cnt) != id-1) ok = false;

  cout << (ok ? "SAFE" : "SUSPICIOUS") << endl;

}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int t; cin >> t;
  while(t--) {
    solve();
  }

}


Measured memory_bytes: 3184