#include #include #include #include #include #include using namespace std; class rect{ public: int x1, x2, y1, y2; rect(){ x1 = 100; x2 = -100; y1 = 100; y2 = -100; } }; int main(){ int testCase; cin >> testCase; while(testCase--){ string input[55]; int h, w; cin >> h >> w; getline(cin, input[54]); for(int j=0; j pos; vector oder; for(int j=0; j= 'A' && input[j][i] <= 'Z'){ char c = input[j][i]; if(pos.find(c) == pos.end()){ pos.insert(make_pair(c, rect())); bool f = true; for(int n=0; n < oder.size(); n++){ if(oder[n] == c){ f = false; break; } } if(f){ oder.push_back(c); } } if(i < pos[c].x1){ pos[c].x1 = i; } if(i > pos[c].x2){ pos[c].x2 = i; } if(j < pos[c].y1){ pos[c].y1 = j; } if(j > pos[c].y2){ pos[c].y2 = j; } } } } bool ans = false; sort(oder.begin(), oder.end()); do{ set upper; bool flag = true; for(int n=0; n < oder.size(); ++n){ char c = oder[n]; upper.insert(c); for(int i = pos[c].x1; i <= pos[c].x2; ++i){ for(int j = pos[c].y1; j <= pos[c].y2; ++j){ if(upper.find(input[j][i]) == upper.end()){ flag = false; } } } } if(flag){ ans = true; } }while(next_permutation(oder.begin(), oder.end())); if(ans){ cout << "SAFE" << endl; }else{ cout << "SUSPICIOUS" << endl; } } return 0; }