#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <numeric>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>



using namespace std;
using Int = long long;
//using namespace boost::multiprecision;

const double EPS = (1e-10);
long long const MOD = 1000000007;

long long mod_pow(long long x, long long n) {
    long long res = 1;
    for(int i = 0;i < 60; i++){
        if(n >> i & 1) res = res * x % MOD;
        x = x * x % MOD;
    }
    return res;
}

template<typename T>
T gcd(T a, T b) {
    return b != 0 ? gcd(b, a % b) : a;
}

template<typename T>
T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

void fastInput() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

struct Baggage {
    int lowerW, upperW, lowerH, upperH;
};

int solve(int H, int W) {
    vector<vector<char>> field(H+1, vector<char>(W+1));

    for (int h = 1; h <= H; h++) {
        for (int w = 1; w <= W; w++) {
            cin >> field[h][w];
        }
    }

    vector<Baggage> vb(26, {1000, -1, 1000, -1});
    for (int h = 1; h <= H; h++) {
        for (int w = 1; w <= W; w++) {
            if (field[h][w] == '.') continue;
            vb[field[h][w] - 'A'].lowerH = min(vb[field[h][w] - 'A'].lowerH, h);
            vb[field[h][w] - 'A'].upperH = max(vb[field[h][w] - 'A'].upperH, h);
            vb[field[h][w] - 'A'].lowerW = min(vb[field[h][w] - 'A'].lowerW, w);
            vb[field[h][w] - 'A'].upperW = max(vb[field[h][w] - 'A'].upperW, w);
        }
    }

    int numOfBaggage = 0;
    for (int i = 0; i < 26; i++) {
        if (vb[i].upperW != -1) numOfBaggage++;
    }

    vector<vector<int>> covered(H+1, vector<int>(W+1));
    for (int i = 0; i < numOfBaggage; i++) {
        for (int j = 0; j < 26; j++) {
            if (vb[j].upperW == -1) continue;
            int lowerW = vb[j].lowerW;
            int upperW = vb[j].upperW;
            int lowerH = vb[j].lowerH;
            int upperH = vb[j].upperH;
            int flag = 1;
            for (int h = 1; h <= H; h++) {
                for (int w = 1; w <= W; w++) {
                    if (lowerW <= w && w <= upperW && lowerH <= h && h <= upperH) {
                        if (field[h][w] != 'A' + j && !covered[h][w]) {
                            flag = 0;
                        }
                    } else {
                        if (field[h][w] == 'A' + j) {
                            flag = 0;
                        }
                    }
                }
            }
            if (flag) {
                vb[j] = {1000, -1, 1000, -1};
                for (int h = lowerH; h <= upperH; h++) {
                    for (int w = lowerW; w <= upperW; w++) {
                        covered[h][w] = 1;
                    }
                }
            }
        }
    }
    int ret = 1;
    for (int i = 0; i < 26; i++) {
        if (vb[i].upperH != -1) ret = 0;
    }
    return ret;
}

int main(void) {
    int N, H, W;
    cin >> N;
    vector<int> ans(N);
    for (int i = 0; i < N; i++) {
        cin >> H >> W;
        ans[i] = (solve(H, W));
    }
    for (auto &i : ans) {
        if (i) cout << "SAFE" << endl;
        else cout << "SUSPICIOUS" << endl;
    }
}





Measured memory_bytes: 3140