#include <bits/stdc++.h>
#pragma gcc optimize("Ofast")
using namespace std;

#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define trav(a, x) for (auto& a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

struct Rect {
	int lti, ltj, rbi, rbj;
	char color;
	const bool operator<(const Rect& r) const {
		return color < r.color;
	}
};

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	int n; cin >> n;
	int h, w;
	for (int tt = 0; tt < n; tt++) {
		cin >> h >> w;
		vector<string> grid(h);
		rep(i, 0, h) cin >> grid[i];
		set<char> colors;
		rep(i, 0, h) rep(j, 0, w) if (grid[i][j] != '.') colors.insert(grid[i][j]);
	
		vector<Rect> rects;
		bool isbad = false;
		for (char color : colors) {
			int lti = -1, ltj = -1, rbi = -1, rbj = -1;
			rep(i, 0, h) rep(j, 0, w) if (grid[i][j] == color) {
				if (lti == -1) lti = rbi = i, ltj = rbj = j;
				else {
					if (i < lti) lti = i;
					if (j < ltj) ltj = j;
					if (i > rbi) rbi = i;
					if (j > rbj) rbj = j;
				}
			}
			//printf("%c: (%d, %d) - (%d, %d)\n", color, lti, ltj, rbi, rbj);
			
			for (int i = lti; i <= rbi; i++) for (int j = ltj; j <= rbj; j++) if (grid[i][j] == '.') {
				isbad = true;
			}
			rects.push_back(Rect {lti, ltj, rbi, rbj, color});
		}

		if (isbad) {
			cout << "SUSPICIOUS" << endl;
			continue;
		}

		vector<string> grid2(h, string(w, '.'));
		bool isgood = false;

		sort(all(rects));
		do {
			for (Rect r : rects) {
				for (int i = r.lti; i <= r.rbi; i++) for (int j = r.ltj; j <= r.rbj; j++)
					grid2[i][j] = r.color;
			}
			if (grid2 == grid)
				isgood = true;
		} while (next_permutation(all(rects)));

		cout << (!isgood ? "SUSPICIOUS" : "SAFE") << '\n';
	}
}

