#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef pair<int,int> pii;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(int i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 2020000;
ll dy[8] = {1,-1,0,0,1,-1,1,-1};
ll dx[8] = {0,0,1,-1,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T> inline void print(T &a){
    rep(i,a.size()) cout << a[i] << " ";
    cout << "\n";
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << "\n";}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << "\n";
}
ll pcount(ll x) {return __builtin_popcount(x);};
const int mod = 1e9 + 7;
//const int mod = 998244353;

template <typename T> struct Compress{
	vector<T> comp;
 
	Compress(vector<T> v) : comp(v){
		sort(comp.begin(), comp.end());
		comp.erase(unique(comp.begin(), comp.end()), comp.end());
	}
 
	ll get(T x){
		return lower_bound(comp.begin(), comp.end(), x) - comp.begin();
	}
 
	T operator[](int id){
		return comp[id];
	}
 
	ll siz(){
		return comp.size();
	}
};

int main(){
    int t; cin >> t;
    while(t--){
        int h,w; cin >> h >> w;
        vs s(h); rep(i,h) cin >> s[i];
        vector<int> c;
        rep(i,h){
            rep(j,w) if(s[i][j] != '.') c.push_back(s[i][j]);
        }
        Compress<int> comp(c);
        vvl v(h,vl(w,-1));
        rep(i,h) rep(j,w){
            if(s[i][j] != '.') v[i][j] = comp.get(s[i][j]);
        }
        int m = comp.siz();
        vl nxt(m); rep(i,m) nxt[i] = i;
        bool fin = false;
        do{
            vvl t(m,vl(m,0));
            rep(i,m) REP(j,i+1,m) t[nxt[i]][nxt[j]] = 1;
            vl l(m,inf),r(m,0),u(m,inf),d(m,0);
            rep(i,h){
                rep(j,w){
                    if(s[i][j] == '.') continue;
                    chmin(l[v[i][j]], j);
                    chmax(r[v[i][j]], j);
                    chmin(u[v[i][j]], i);
                    chmax(d[v[i][j]], i);
                }
            }
            bool f = true;
            rep(k,m){
                REP(i,u[k],d[k]+1){
                    REP(j,l[k],r[k]+1){
                        if(v[i][j] == k) continue;
                        if(s[i][j] == '.') f = false;
                        if(!t[k][v[i][j]]) f = false;
                    }
                }
            }
            if(f){
                puts("SAFE");
                fin = true;
            }
            if(fin) break;
        }while(next_permutation(all(nxt)));
        if(fin) continue;
        puts("SUSPICIOUS");
    }
}


Measured memory_bytes: 3136