#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

struct P {
    int x, y, cost;

    P(int x, int y, int cost): x(x), y(y), cost(cost) {}

    bool operator >(const P& p) const {
        return cost > p.cost;
    }
};

const int dx[] = {-1,0,1,0}; const int dy[] = {0,1,0,-1};

#define X_MAX 50
#define Y_MAX 50

char box[Y_MAX][X_MAX];

struct xy {
    int x_min, x_max, y_min, y_max;
};

bool check_rect(vector<xy>& rect) {
    for (auto r : rect) {
        FOR(y, r.y_min, r.y_max+1) {
        FOR(x, r.x_min, r.x_max+1) {
            if (box[y][x] == '.') {
                return false;
            }
        }
        }
    }
    return true;
}

bool is_top(xy r, char c) {
    FOR(y, r.y_min, r.y_max+1) {
    FOR(x, r.x_min, r.x_max+1) {
        if (box[y][x] != c && box[y][x] != '#') {
            return false;
        }
    }
    }
    FOR(y, r.y_min, r.y_max+1) {
    FOR(x, r.x_min, r.x_max+1) {
        box[y][x] = '#';
    }
    }
    return true;
}

int main() {
    int n;
    cin >> n;
    REP(i, n) {
        int h, w;
        cin >> h >> w;
        fill_n((char *)box, Y_MAX*X_MAX, '.');

        set<char> material_s;
        REP(y, h) {
        REP(x, w) {
            cin >> box[y][x];
            if (box[y][x] != '.') {
                material_s.insert(box[y][x]);
            }
        }
        }
        map<char, int> material;
        for (auto it = material_s.begin(); it != material_s.end(); it++) {
            material.insert({*it, material.size()});
        }

        vector<xy> rect(material.size(), {X_MAX, 0, Y_MAX, 0});
        REP(y, h) {
        REP(x, w) {
            if (box[y][x] != '.') {
                int idx = material[box[y][x]];
                rect[idx].x_min = min(rect[idx].x_min, x);
                rect[idx].x_max = max(rect[idx].x_max, x);
                rect[idx].y_min = min(rect[idx].y_min, y);
                rect[idx].y_max = max(rect[idx].y_max, y);
            }
        }
        }

        if (!check_rect(rect)) {
            cout << "SUSPICIOUS" << endl;
            continue;
        }

        bool updated;
        int n = 0;
        vb seen(material.size());
        do {
            updated = false;
            for (auto it = material.begin(); it != material.end(); it++) {
                if (!seen[it->second] && is_top(rect[it->second], it->first)) {
                    n++;
                    seen[it->second] = true;
                    updated = true;
                }
            }
        } while (updated);

        cout << (n == rect.size() ? "SAFE" : "SUSPICIOUS") << endl;
    }
}

Measured memory_bytes: 1188