#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>
#include <cassert>

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;

const int XMAX = 50;
const int YMAX = 50;

#define NONE '.'
#define SOME '#'

char box[YMAX][XMAX];

struct rect{
    int l, u, r, d;
};

void print_rects(vector<rect>& rects){
    for(auto r:rects){
        LOG("%d %d %d %d\n", r.l, r.u, r.r,r.d);
        FOR(y, r.u, r.d + 1){
            FOR(x, r.l, r.r + 1) {
                LOG("%c", box[y][x]);
            }
            LOG("\n");
        }
    }
}

bool check_rects(vector<rect>& rects){
    for(auto r:rects) {
        FOR(y, r.u, r.d + 1) {
            FOR(x, r.l, r.r + 1) {
                if (box[y][x] == NONE) return false;
            }
        }
    }

    return true;
}

bool is_top(rect& r, char material){
    FOR(y, r.u, r.d + 1){
        FOR(x, r.l, r.r + 1) {
            if(box[y][x] != material && box[y][x] != SOME) return false;
        }
    }

    FOR(y, r.u, r.d + 1){
        FOR(x, r.l, r.r + 1) {
            box[y][x] = SOME;
        }
    }

    return true;
}

int main() {
    int n, h ,w;
    cin >> n;
    REP(k, n){
        fill_n((char *)box, YMAX * XMAX, NONE);
        map<char, int> material;
        vector<rect> rects;

        cin >> h >> w;
        REP(y, h) {
            REP(x, w) {
                cin >> box[y][x];
                if(box[y][x] == NONE) continue;
                if (material.find(box[y][x]) == material.end()) {
                    material.insert({box[y][x], material.size()});
                    rects.push_back({XMAX, YMAX, 0, 0});
                }
                int idx = material[box[y][x]];
                rects[idx].l = min(rects[idx].l, x);
                rects[idx].u = min(rects[idx].u, y);
                rects[idx].r = max(rects[idx].r, x);
                rects[idx].d = max(rects[idx].d, y);
            }
        }

        if (!check_rects(rects)) {
            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(rects[it->second], it->first)){
                    n++;
                    seen[it->second] = true;
                    updated = true;
                }
            }
        }while(updated);

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

Measured memory_bytes: 1212