def get_rect(c)
	x1 = x2 = y1 = y2 = -1

	0.upto($h-1) do |y|
		0.upto($w-1) do |x|
			if $d[y][x] == c then
				y2 = y
				next
			end
		end
	end

	($h-1).downto(0) do |y|
		0.upto($w-1) do |x|
			if $d[y][x] == c then
				y1 = y
				next
			end
		end
	end

	0.upto($w-1) do |x|
		0.upto($h-1) do |y|
			if $d[y][x] == c then
				x2 = x
				next
			end
		end
	end

	($w-1).downto(0) do |x|
		0.upto($h-1) do |y|
			if $d[y][x] == c then
				x1 = x
				next
			end
		end
	end

	return x1, x2, y1, y2
end

def check(c)
	x1, x2, y1, y2 = get_rect(c)

	for y in y1 .. y2
		for x in x1 .. x2
			if $d[y][x] == '.' then
				return false
			elsif $mt.find_index($d[y][x]) != nil then
				return false
			end
		end
	end

	$mt.push c

	for y in y1 .. y2
		for x in x1 .. x2
			if $d[y][x] != c && $d[y][x] != ' ' then
				if check($d[y][x]) == false then
					return false
				end
			end
		end
	end

	for y in y1 .. y2
		for x in x1 .. x2
			if $d[y][x] == c then
				$d[y][x] = ' '
			end
		end
	end

	return true
end

def search()
	$h.times do |y|
		$w.times do |x|
			if $d[y][x] != '.' && $d[y][x] != ' ' then
				if check($d[y][x]) == false then
					return false
				end
			end
		end
	end

	return true
end

n = gets.to_i

n.times do
	$h, $w = gets.split.map(&:to_i)

	$d = []
	$h.times do
		$d.push gets.chomp.split('')
	end

	$mt = []

	puts search() ? "SAFE" : "SUSPICIOUS"
end