#include <bits/stdc++.h>
#define csize 26
using namespace std;

struct data {
  int l, r, u, d;
};
int h, w, t;
string s[55];
data dummy{10000, -1, 100000, -1};
vector<data> lst(26);
bool memo[30][30] = {0};
vector<int> cperm;

bool solve();
void lstset(int x, int i, int j);

int main() {
  cin >> t;
  for(int tt = 0; tt < t; ++tt) {
    cin >> h >> w;
    for(int i = 0; i < h; ++i) cin >> s[i];
    for(int i = -0; i < csize; ++i) lst[i] = dummy;
    if(solve())
      cout << "SUSPICIOUS" << endl;
    else
      cout << "SAFE" << endl;
    for(int i = 0; i < 26; ++i)
      for(int j = 0; j < 26; ++j) memo[i][j] = 0;
    cperm.erase(cperm.begin(), cperm.end());
  }
  return 0;
}

bool solve() {
  for(int i = 0; i < h; ++i)
    for(int j = 0; j < w; ++j)
      if(s[i][j] != '.') lstset(s[i][j] - 'A', i, j);
  for(int i = 0; i < csize; ++i)
    if(lst[i].r != -1) {
      for(int j = lst[i].u; j <= lst[i].d; ++j)
        for(int k = lst[i].l; k <= lst[i].r; ++k) {
          if(s[j][k] == '.')
            return 1;
          else if(s[j][k] - 'A' != i)
            memo[s[j][k] - 'A'][i] = 1;
        }
      cperm.push_back(i);
    }
  int cpermsize = cperm.size();
  do {
    bool ok = 1;
    for(int i = 0; i < cpermsize; ++i)
      for(int j = i + 1; j < cpermsize; ++j)
        if(memo[cperm[j]][cperm[i]]) ok = 0;
    if(ok) return 0;
  } while(next_permutation(cperm.begin(), cperm.end()));
  return 1;
}

void lstset(int x, int i, int j) {
  lst[x].l = min(lst[x].l, j);
  lst[x].r = max(lst[x].r, j);
  lst[x].u = min(lst[x].u, i);
  lst[x].d = max(lst[x].d, i);
}
