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

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define rrev(i, m, n) for(int (i)=(n)-1; (i)>=(m); (i)--)
#define erev(i, m, n) for(int (i)=(n); (i)>=(m); (i)--)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define pb            push_back
template<class T, class S> inline pair<T, S> mp(const T x, const S y){ return make_pair(x, y); }
template<class T, class S> inline bool minup(T& m, const S x){ return m>(T)x ? (m=(T)x, true) : false; }
template<class T, class S> inline bool maxup(T& m, const S x){ return m<(T)x ? (m=(T)x, true) : false; }

static const int    INF = 1000000000;
static const ll     MOD = 1000000007LL;
static const double EPS = 1E-10;

const int MAX_H = 55;
const int MAX_W = 55;
int H, W;
char s[MAX_H][MAX_W+1];
int d[MAX_H][MAX_W+1];
bool flag[10][10];
int N;

inline bool check(int hx, int hy){ return 0 <= hx && hx < H && 0 <= hy && hy < W; }

typedef int Weight;
struct Edge {
  int src, dst;
  Weight weight;
  Edge(int src, int dst, Weight weight) : src(src), dst(dst), weight(weight) { }
};
bool operator < (const Edge &e, const Edge &f) {
  return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
    e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

typedef vector<Weight> Array;
typedef vector<Array> Matrix;


// ??????????????????????????????????????¨?????????order??????????????\???
// O(V+E)
bool visit(const Graph& g, int v, vi& order, vi& color)
{
  color[v] = 1;
  vrep(e, g[v]) {
    if (color[e->dst] == 2) continue;
    if (color[e->dst] == 1) return false;
    if (!visit(g, e->dst, order, color)) return false;
  }
  order.push_back(v); color[v] = 2;
  return true;
}

bool TopologicalSort(const Graph& g)
{
  int n = g.size();
  vi color(n);
  vi order;
  rep(u, n) if (!color[u] && !visit(g, u, order, color)) return false;
  return true;
}


int main()
{
  cin >> N;

  while(N--){
    cin >> H >> W;
    rep(i, H) rep(j, W) cin >> s[i][j];


    map<char, int> hm;
    int cnt = 0;
    vector<char> vec;
    rep(i, H) rep(j, W) if(s[i][j] != '.' && !hm[s[i][j]]){
      hm[s[i][j]] = cnt++;
      vec.push_back(s[i][j]);
    }

    rep(i, cnt) rep(j, cnt) flag[i][j] = false;
    Graph g(cnt);
    bool ok = true;
    rep(k, vec.size()){
      int sx = INF, tx = 0;
      int sy = INF, ty = 0;
      rep(i, H) rep(j, W) if(s[i][j] == vec[k]){
        sx = min(sx, i);  tx = max(tx, i);
        sy = min(sy, j);  ty = max(ty, j);
      }

      erep(i, sx, tx) erep(j, sy, ty){
        ok &= s[i][j] != '.';
        if(s[i][j] != vec[k] && !flag[hm[s[i][j]]][hm[vec[k]]]){ // A < B ?????? A ??? B
          flag[hm[s[i][j]]][hm[vec[k]]] = true;
          g[hm[s[i][j]]].pb(Edge(hm[s[i][j]], hm[vec[k]], 1));
        }
      }
      if(!ok) break;
    }

    puts(ok && TopologicalSort(g) ? "SAFE" : "SUSPICIOUS");
  }

  return 0;
}

Measured memory_bytes: 1180