#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>

using namespace std;

int h,w;
char field[51][51];
bool passed[10];

struct nodeInfo{
    int minx;
    int miny;
    int maxx;
    int maxy;
    char kind;
    set<char> chars;
};

int minx,miny,maxx,maxy;
map<char,int> key;
int node;
vector<int> G[10];
bool isClosing=false;
nodeInfo recInfo[10];

void findRecSize (int y,int x,char kind){
    for(int i = 0;i < h; i++){
        for(int j = 0; j < w; j++){
            if(field[i][j]==kind){
                miny=min(miny,i);
                minx=min(minx,j);
                maxy=max(maxy,i);
                maxx=max(maxx,j);
            }
        }
    }
}

void findClose(int s){
    if(isClosing)
        return;
    //if(passed[s]){
    //    isClosing=true;
    //    return;
    //}
    for(int i = 0; i < G[s].size(); i++){
        if(passed[G[s][i]]){
            isClosing=true;
            return;
        }
        passed[G[s][i]]=true;
        findClose(G[s][i]);
        passed[G[s][i]]=false;
    }
}

void dfs(int node,set<char> s){

}

int main(){
    int n;
    cin>>n;
    while(n--){
        for(int i = 0; i < 10; i++){
            recInfo[i].chars.clear();
            G[i].clear();
        }
        node=0;
        key.clear();
        cin>>h>>w;
        memset(passed,0,sizeof(passed));
        for(int i = 0; i < h; i++)
            for(int j = 0; j < w; j++)
                cin>>field[i][j];
        bool no=false;
        vector<int> roots;
        // ·û`»è
        for(int i = 0; i < h; i++){
            for(int j = 0; j < w; j++){
                char kind=field[i][j];
                if(kind!='.'&&(key.find(kind)==key.end())){
                    // nodeðV½Éo^·é
                    key[kind]=node;
                    node++;
                    minx=miny=100;
                    maxx=maxy=-1;
                    findRecSize(i,j,kind);
                    recInfo[node-1].maxx=maxx;
                    recInfo[node-1].maxy=maxy;
                    recInfo[node-1].minx=minx;
                    recInfo[node-1].miny=miny;
                    recInfo[node-1].kind=kind;
                    bool isRoot=true;
                    // ß½x,y»ê¼êÌÀWîñ©ç¾çê½l¦¤é·û`Ì`ÌTõðs¤
                    for(int k = miny; k <= maxy; k++){
                        for(int l = minx; l <= maxx; l++){
                            // TõææÉ.ª¶Ýµ½êA·û`ÅÍÈ¢
                            if(field[k][l]=='.'){
                                no=true;
                                break;
                            }
                            else if(field[k][l]!=kind){
                                isRoot=false;
                            }
                            recInfo[node-1].chars.insert(field[k][l]);
                        }
                        if(no)
                            break;
                    }
                    if(isRoot)
                        roots.push_back(node-1);
                }
                if(no)
                    break;
            }
            if(no)
                break;
        }
        if(no){
            cout<<"SUSPICIOUS"<<endl;
            continue;
        }
        

        // dÈèÌ
        // ãÌÙ¤©çºÌÙ¤ÖGbWð£é
        for(int l = 0; l < node; l++){
            int mnx=recInfo[l].minx;
            int mxx=recInfo[l].maxx;
            int mny=recInfo[l].miny;
            int mxy=recInfo[l].maxy;
            char kind=recInfo[l].kind;
            for(int i = mny; i <= mxy; i++){
                for(int j = mnx; j <= mxx; j++){
                    if(field[i][j]!=kind){
                        int from=key[field[i][j]];
                        int to=key[kind];
                        // Ü¾GbWª¢o^
                        if(find(G[from].begin(),G[from].end(),to)==G[from].end())
                            G[from].push_back(to);
                    }
                }
            }
        }
        
        //memset(passed,0,sizeof(passed));
        //// ª©çÔÉºÖ½ÇÁÄ¢­
        //// SÌm[hÉ½Çè¯È¢ÌÅ êÎAfalse
        //for(int l = 0; l < roots.size(); l++){
        //    int cr=roots[l];
        //    set<char> s;
        //    s.insert(recInfo[cr].kind);
        //    dfs(cr,s);
        //}

        // ÂHª¶Ý·é©Tõ
        isClosing=false;
        for(int i = 0; i < node; i++){
            memset(passed,0,sizeof(passed));
            passed[i]=true;
            findClose(i);
            if(isClosing)
                break;
        }
        if(key.size()!=0&&(isClosing)){
            cout<<"SUSPICIOUS"<<endl;
            continue;
        }
        else{

            cout<<"SAFE"<<endl;
        }
    }

    return 0;
}

Measured memory_bytes: 900