// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



int main()

{

	int N, H, W;

	cin >> N;

	while (N--) {

		cin >> H >> W;

		vector<int> used(26), xma(26), xmi(26, 100), yma(26), ymi(26, 100);

		vector<vector<char>> a(H, vector<char>(W));

		for (int i = 0; i < H; i++) {

			for (int j = 0; j < W; j++) {

				cin >> a[i][j];

				if (a[i][j] != '.') {

					int p = a[i][j] - 'A';

					used[p] = 1;

					xma[p] = max(xma[p], i);

					xmi[p] = min(xmi[p], i);

					yma[p] = max(yma[p], j);

					ymi[p] = min(ymi[p], j);

				}

			}

		}

		vector<vector<int>> d(26, vector<int>(26, 1000));

		for (int i = 0; i < 26; i++) {

			d[i][i] = 0;

		}

		bool sus = false;

		for (int i = 0; i < 26; i++) {

			if (used[i]) {

				for (int x = xmi[i]; x <= xma[i]; x++) {

					for (int y = ymi[i]; y <= yma[i]; y++) {

						if (a[x][y] == '.') {

							sus = true;

						}

						else if (a[x][y] - 'A' != i) {

							d[i][a[x][y] - 'A'] = -1;

						}

					}

				}

			}

		}

		for (int k = 0; k < 26; k++) {

			for (int i = 0; i < 26; i++) {

				for (int j = 0; j < 26; j++) {

					d[i][j] = min(d[i][j], d[i][k] + d[k][j]);

				}

			}

		}

		for (int i = 0; i < 26; i++) {

			if (d[i][i] < 0) {

				sus = true;

				break;

			}

		}

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

	}

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.1877038624586318x):
#include "bits/stdc++.h"

using namespace std;

typedef long long ll;

typedef pair<int, int> pii;

typedef pair<ll, ll> pll;

const int INF = 1e9;

const ll LINF = 1e18;

template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }

template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }

template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }

template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }



/*

 <url:>

 問題文============================================================

 =================================================================

 解説=============================================================

 ================================================================

 */



bool check(int minx,int miny,int maxx,int maxy,int key,vector<vector<char>>& masu){

    for(int i = minx; i <= maxx; i++){

        for(int j = miny; j <= maxy;j++){

            if(masu[i][j] == '*' || masu[i][j] == key) continue;

            return false;

        }

    }

    return true;

}



void Fill(int minx,int miny,int maxx,int maxy,vector<vector<char>>& masu){

    for(int i = minx; i <= maxx; i++){

        for(int j = miny; j <= maxy;j++){

            masu[i][j] = '*';

        }

    }

}



string solve(){

    ll H,W; cin >> H >> W;

    vector<vector<char>> masu(H,vector<char>(W));

    for(int i = 0; i < H;i++){

        for(int j = 0; j < W;j++){

            cin >> masu[i][j];

        }

    }

    vector<pair<pii,pii>> X(26,{{INF,INF},{-INF,-INF}});

    for(int i = 0; i < H;i++){

        for(int j = 0; j < W;j++){

            if(masu[i][j] == '.') continue;

            masu[i][j] -= 'A';

            pair<pii,pii>& piiii = X[masu[i][j]];

            piiii.first.first = min(piiii.first.first,i);

            piiii.first.second = min(piiii.first.second,j);

            piiii.second.first = max(piiii.second.first,i);

            piiii.second.second = max(piiii.second.second,j);

        }

    }

    while(true){

        bool update = [&]{

            for(int i = 0; i < 26;i++){

                if(X[i].first.first == INF) continue;

                if(check(X[i].first.first,X[i].first.second,X[i].second.first,X[i].second.second,i,masu)){

                    Fill(X[i].first.first,X[i].first.second,X[i].second.first,X[i].second.second,masu);

                    X[i].first.first = INF;

                    return true;

                }

            }

            return false;

        }();

        if(update) continue;

        else break;

    }

    

    for(int i = 0; i < H;i++){

        for(int j = 0; j < W;j++){

            if(masu[i][j] == '.') continue;

            if(masu[i][j] == '*') continue;

            return "SUSPICIOUS";

        }

    }

    return "SAFE";

}

int main(void) {

    cin.tie(0); ios_base::sync_with_stdio(false);

    ll T; cin >> T;

    while(T--){

        cout << solve() << endl;

    }

    return 0;

}