import std.stdio;
import std.c.stdio;
import std.range;
import std.array;
import std.functional;
import std.algorithm;
import std.conv;
import std.container;
import std.math;
import std.numeric;
import std.string;
import std.c.string;
import std.regex;
import std.typecons;

int H, W;
char[][] F;
void input() {
    scanf("%d %d\n", &H, &W);
    F = new char[][H];
    foreach (h; 0 .. H) {
        F[h] = cast(char[])(readln.chomp);
    }
}

bool check() {
    int[char] sx, sy, gx, gy;
    bool[char] used;
    foreach (y; 0 .. H) {
        foreach (x; 0 .. W) {
            if (F[y][x] == '.') continue;
            char c = F[y][x];
            if (c in used) {
                sx[c] = min(sx[c], x);
                sy[c] = min(sy[c], y);
                gx[c] = max(gx[c], x);
                gy[c] = max(gy[c], y);
            } else {
                used[c] = true;
                sx[c] = x;
                sy[c] = y;
                gx[c] = x;
                gy[c] = y;
            }
        }
    }
    auto G = new bool[][](26, 26);
    foreach (c, p; used) {
        for (int y = sy[c]; y <= gy[c]; y++) {
            for (int x = sx[c]; x <= gx[c]; x++) {
                if (F[y][x] == '.') {
                    return false;
                }
                if (F[y][x] != c) {
                    char d = F[y][x];
                    int xc = c - 'A',
                        xd = d - 'A';
                    if (G[xd][xc]) return false;
                    G[xc][xd] = true;
                }
            }
        }
    }

    version(Debug) {
        foreach (i; 0 .. 26) {
            foreach (j; 0 .. 26) {
                if (G[i][j]) {
                    writefln("%c -> %c", cast(char)(i + 'A'), cast(char)(j + 'A'));
                }
            }
        }
    }

    foreach (i; 0 .. 26) {
        bool flag = false;
        bool dfs(int x) {
            if (i == x) {
                if (flag) return false;
                flag = true;
            }
            foreach (j; 0 .. 26) {
                if (G[x][j] && (!dfs(j))) {
                    return false;
                }
            }
            return true;
        }
        if (!dfs(i)) return false;
    }
    return true;
}

void solve() {
    writeln(check ? "SAFE" : "SUSPICIOUS");
}

 
void main() {
    int T; scanf("%d\n", &T);
    foreach (t; 0 .. T) {
        input; solve;
    }
}