import std.stdio;
import std.algorithm;
import std.string;
import std.range;
import std.array;
import std.conv;
import std.complex;
import std.math;
import std.ascii;
import std.bigint;
import std.container;

bool test(int[][] s, int n) {
	auto rect = new bool[](n+1);
	rect[n] = false;
	foreach(_; 0..n) {
		foreach(i; 0..n) {
			ulong xmin, ymin, xmax, ymax;
			xmin = s[0].length;
			ymin = s.length;
			xmax = 0;
			ymax = 0;
			foreach(j; 0..s.length) {
				foreach(k; 0..s[0].length) {
					if(s[j][k] == i) {
						xmin = min(xmin, k);
						ymin = min(ymin, j);
						xmax = max(xmax, k);
						ymax = max(ymax, j);
					}
				}
			}
			bool f = true;
			if(xmax >= xmin && ymax >= ymin) {
				foreach(j; ymin..ymax+1) {
					foreach(k; xmin..xmax+1) {
						f &= s[j][k] == i || rect[s[j][k]];
					}
				}
				rect[i] |= f;
			}
		}
	}
	rect[n] = true;
	return !n || reduce!("a&&b")(rect);
}

void main() {
	int n = to!int(readln().strip());
	foreach(_; 0..n) {
		auto hw = map!(to!int)(readln().strip().split());
		int h = hw[0];
		int w = hw[1];
		string[] s;
		int[char] c;
		int cn;
		foreach(i; 0..h) {
			s ~= readln().strip();
		}
		foreach(i; 0..h) {
			foreach(j; 0..w) {
				if(s[i][j] != '.' && s[i][j] !in c)
					c[s[i][j]] = cn++;
			}
		}
		c['.'] = cn;
		auto t = new int[][](h,w);
		foreach(i; 0..h) {
			foreach(j; 0..w) {
				t[i][j] = c[s[i][j]];
			}
		}
		writeln(test(t, cn)?"SAFE":"SUSPICIOUS");
	}
}