import std.stdio;
import std.array;
import std.conv;
import std.typecons;
import std.algorithm;
import std.container;
import std.bigint;

alias Tuple!(int, int, int, int) Data;

void main()
{
	string[] results;
	int size = to!int(readln.split[0]);
	Data[26] dataList;
	foreach (i; 0..size) {
		auto strs = readln.split;
		int H = to!int(strs[0]);
		int W = to!int(strs[1]);
		int[][] area;
		area.length = W;
		foreach (ref b; area) {
			b.length = H;
		}
		//??????????????????
		foreach (y; 0..H) {
			auto str = readln;
			foreach (x; 0..W) {
				char c = str[x];
				int a = c - 'A';
				if (c != '.') {
					if (dataList[a] != Data.init) {
						dataList[a][0] = min(dataList[a][0], x);
						dataList[a][1] = max(dataList[a][1], x);
						dataList[a][2] = min(dataList[a][2], y);
						dataList[a][3] = max(dataList[a][3], y);
					} else {
						dataList[a] = tuple(x, x, y, y);
					}
				}
				area[x][y] = a;
			}
		}
		Tuple!(int, int)[] priority; //A is in front of B;
		bool success = true;
	loop:
		foreach (j; 0..26) {
			if (dataList[j] == Data.init) continue;
			auto data = dataList[j];
			foreach (x; data[0]..data[1]+1) {
				foreach (y; data[2]..data[3]+1) {
					if (area[x][y] == '.') {
						success = false;
						break loop;
					} else if (area[x][y] != j) {
						foreach (p; priority) {
							if (p[0] == j && p[1] == area[x][y]) {
								success = false;
								break loop;
							}
						}
						priority ~= tuple(area[x][y], j);
					}
				}
			}
		}
		if (success) results ~= "SAFE";
		else results ~= "SUSPICIOUS";
	}
	foreach (r; results)
		r.writeln;
}