#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define REP(i,n) for(int i=0;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<29
#define LINF LLONG_MAX/3
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(v) (v).begin(),(v).end()
#define all(v) ALL(v)
#define Dedupe(v) (v).erase(unique(ALL((v))),(v).end())
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
#define CININIT cin.tie(0),ios::sync_with_stdio(false)
struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/
int h,w;
char tbl[64][64];

void solve(){
    rep(i,64) rep(j,64) tbl[i][j]=0;

    cin>>h>>w;
    rep(i,h) rep(j,w) cin>>tbl[i][j];

    vector<vector<int>> g(32);

    for(char c='A';c<='Z';c++){
        int u=INF,d=-INF,l=INF,r=-INF;
        rep(i,h) rep(j,w){
            if(tbl[i][j]==c){
                u=min(u,i);
                d=max(d,i);
                l=min(l,j);
                r=max(r,j);
            }
        }
        for(int i=u;i<=d;i++) for(int j=l;j<=r;j++) if(tbl[i][j]=='.'){
            cout << "SUSPICIOUS" << endl;
            return;
        }
        for(int i=u;i<=d;i++) for(int j=l;j<=r;j++){
            if(i<0 or j<0) continue;
            if('A'<=tbl[i][j] and tbl[i][j]<='Z' and tbl[i][j]!=c){
                g[c-'A'].push_back(tbl[i][j]-'A');
            }
        }
    }
    for(int i=0;i<32;i++){
        sort(all(g[i]));
        Dedupe(g[i]);
    }

    /*
    for(int i=0;i<32;i++){
        if(g[i].size()==0) continue;
        cout << (char)(i+'A') << " : [";
        for(int j=0;j<g[i].size();j++) cout << (char)(g[i][j]+'A') << ",";
        cout << "]" << endl;
    }
    */

    bool used[32];
    for(char c='A';c<='Z';c++){
        rep(i,32) used[i]=false;
        int t=c-'A';
        if(g[t].size()==0) continue;
//        cout << c << endl;

        queue<int> que;
        que.push(t);
        while(!que.empty()){
            int p=que.front();
            que.pop();
//            cout << "\t" << (char)(p+'A') << endl;

            used[p] = true;

            for(int i=0;i<g[p].size();i++){
                int ne = g[p][i];
                if(ne+'A'==c){
                    cout << "SUSPICIOUS" << endl;
                    return;
                }
                if(used[ne]){
                    continue;
                }
                que.push(ne);
            }
        }
    }
    cout << "SAFE" << endl;
}


int main(){
    int n;
    cin>>n;
    rep(i,n) solve();
}

Measured memory_bytes: 3116