#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <vector>
using namespace std;

typedef pair<char,char> P;

int main(){
	int t;
	cin >> t;
	for(int a = 0;a < t;a++){
		int h,w;
		map<char,int> xmin,xmax,ymin,ymax,in;
		map<char,bool> used;
		map<char,vector<int> > G;
		map<P,bool> already;
		string field[50];
		cin >> h >> w;
		for(int i = 0;i < h;i++){
			cin >> field[i];
			for(int j = 0;j < w;j++){
				if(field[i][j] != '.'){
					if(xmin.find(field[i][j]) == xmin.end()){
						xmin[field[i][j]] = i;
						xmax[field[i][j]] = i;
						ymin[field[i][j]] = j;
						ymax[field[i][j]] = j;
					}
					else{
						xmin[field[i][j]] = min(i,xmin[field[i][j]]);
						xmax[field[i][j]] = max(i,xmax[field[i][j]]);
						ymin[field[i][j]] = min(j,ymin[field[i][j]]);
						ymax[field[i][j]] = max(j,ymax[field[i][j]]);
					}
				}
			}
		}
		bool flag = true;
		for(auto it = xmin.begin();it != xmin.end();it++) {
			in[it->first] = 0;
			used[it->first] = false;
		}
		for(auto it = xmin.begin();it != xmin.end();it++){
			char c = it->first;
			for(int i = xmin[c];i <= xmax[c];i++){
				for(int j = ymin[c];j <= ymax[c];j++){
					if(field[i][j] == '.') flag = false;
					else if(field[i][j] != c && !already[P(c,field[i][j])]){
						G[c].push_back(field[i][j]);
						in[field[i][j]]++;
						already[P(c,field[i][j])] = true;
					}
				}
			}
		}
		queue<char> que;
		for(auto it = in.begin();it != in.end();it++){
			if(it->second == 0) que.push(it->first);
		}
		while(!que.empty()){
			char v = que.front();que.pop();
			used[v] = true;
			for(int i = 0;i < G[v].size();i++){
				char to = G[v][i];
				in[to]--;
				if(!in[to]){
					que.push(to);
				}
			}
		}
		for(auto it = used.begin();it != used.end();it++){
			if(!it->second) flag = false;
		}
		if(flag) cout << "SAFE" << endl;
		else cout << "SUSPICIOUS" << endl;
	}
	return 0;
}