#include <string>
#include <algorithm>
#include <iostream>
#include <sstream>

using namespace std;
string enumerate(int,int,int,int);
void range(char);
bool consistent_order(string);

char datas[50][50];
int data;
char moji;
int min_x[256];
int max_x[256];
int min_y[256];
int max_y[256];
string include_moji[256];
//string datas[50][50];

int main(){
  //  char c = word[1];
  //  long int a;
  int h,w,tmp;
  //  char datas[50][50];
  //word3[3] = 'K';
  //  cout << word << " " << word2 << " " << word3 << " "  <<c << endl;
  //cin >> word;
  //cout << word.size() << endl;
  while(cin >> tmp){
    //cout << tmp << endl;
    for(int kaisu=0;kaisu<tmp;kaisu++){
      //cout << tmp << endl;//\¦p
      cin >> h >> w;
      //cout << endl <<"Size:"<<h << "*"<< w << endl;//¯¶­\¦p
      
      for(int i=0;i<256;i++){
	min_x[i] = max_x[i] = min_y[i] = max_y[i] = -1;
      }
      
      for(int i=0;i<h;i++){
	for(int j=0;j<w;j++){
	  cin >> datas[i][j];
	  data=int(datas[i][j]);
	  if(min_x[data]==-1){
	    min_x[data] = max_x[data] = i;
	    min_y[data] = max_y[data] = j;
	  }
	  if(max_x[data] < i){
	    max_x[data] = i;
	    //cout << "max_xXV" << endl;
	  }else if(min_x[data] > i){
	    min_x[data]  = i;
	  }
	  if(max_y[data] < j){
	    max_y[data] = j;
	    //cout << "max_yXV" << endl;
	  }else if(min_y[data] > j){
	    min_y[data]  = j;
	  }
	  //cout << datas[i][j];// <<" ";\¦p
	}
	//cout << endl;
      }

      
      string enume = enumerate(0,0,w-1,h-1);
      //cout << enume << endl;
      sort(enume.begin(), enume.end());
      //cout << enume << endl;
      if(enume == "."){
	cout << "SAFE" << endl;
      }else{
	//cout << enume[0] << endl;
	if(enume[0]=='.'){
	  enume.erase(0,1);
	  //cout << "erased" << enume << endl;
	}
	//cout << enume << endl;
	//cin >> w >> h >> endl;
	//cout << enumerate(0,0,w,h) << endl;
	//cout << enume.size() << "enume.size()" << endl;
	string all =" ";
	
	for(unsigned int k=0;k<enume.size();k++){
	  moji = enume[k];
	  all+=enumerate(min_y[moji],min_x[moji],max_y[moji],max_x[moji]);
	}
	
	if(all.find('.') != string::npos){ //àµ·û`àÉ.ª Á½çAâßé
	  cout << "SUSPICIOUS" << endl;
	}else{
	  for(unsigned int k=0;k<enume.size();k++){
	    moji = enume[k];
	    include_moji[moji] = enumerate(min_y[moji],
					   min_x[moji],max_y[moji],max_x[moji]);
	    //range(enume[k]);
	    //sort(include_moji.begin(),include_moji.end());
	    //string include_moji = enumerate(min_y[moji],
	    //min_x[moji],max_y[moji],max_x[moji]);
	    //cout << moji << " " << include_moji[moji] << endl;
	  }
	  
	  //cout << enume << endl;
	  
	  if(!consistent_order(enume)){
	    cout << "SUSPICIOUS" << endl;
	  }	
	}
      }
      
    }    
  }
}


string enumerate(int left, int top, int right, int bottom){
  string all="";
  for(int i=top;i <= bottom; i++){
    for(int j=left;j <= right;j++){
      //±ÌªÌL@ªöµ¢ ±±©ç
      if(all.find(datas[i][j])==string::npos){
	all += datas[i][j];
	//±±ÜÅ
	//cout << datas[i][j];
      }
    }
  }
  return all;	
}

void range(char c){
  int l,t,r,b;
  l=min_x[int(c)];
  t=min_y[int(c)];
  r=max_x[int(c)];
  b=max_y[int(c)];
  
  cout << c << "; l:" << l << " t:" << t << " r:" << r << " b:" << b << endl;
}

bool consistent_order(string order){
  int i;
  int order_size = order.size();
  do{
    for(i=0 ; i<order_size;i++){
      string wa = "";
      for(int j=i+1;j<order_size;j++){
	wa += include_moji[order[j]];	
      }
      //cout << "iÈ~" << i << " a" << wa << endl; 
      if(wa.find(order[i])!= string::npos/*false*//*½©ðð­*/){
	//if(false){
	break;
      }
      continue;
    }
    if(i==order_size){
      cout <<"SAFE" << endl;
      return true;
    }
  }while(next_permutation(order.begin(),order.end()));
  //cout << "\¦³êÈ¢Í¸";
  return false;
}

//cout <<"i:"<<i<<" includemoji_i"<<include_moji[i] << endl;
//cout << order[i] << " " << int(include_moji[i].find(order[i])!= string::npos) << endl;

/*
  do{
  if(consistent_order(enume)){
  //cout << "SAFE" << endl;
    break;
    }
    //cout << "SUSPICIOUS" << endl;
    //cout << enume << endl;
    }while(next_permutation(enume.begin(),enume.end()));
*/
/*
  if(word.find("A") != string::npos){}
  wrod.erase(word.begin() +n);
  sort(word.begin(), word.end());
  word.erase(unique(word.begin(), word.end() ), word.end());
  sort(word.begin(), word.end());
  do{
  cout << word << endl;
  }while(next_permutation(word.begin(),word.end()));
*/

Measured memory_bytes: 924