n = gets.to_i
n.times do
    h, w = gets.split.map(&:to_i)
    a = (1..h).map { gets.chomp }
    chars = a.join.split("").uniq - [?.]
    safe = chars.empty? ? true : false
    chars.permutation(chars.size) do |perm|
        b = Marshal.load(Marshal.dump(a))
        catch :exit do
            perm.each do |c| 
                y1 = b.index {|row| row =~ /#{c}/}
                y2 = b.rindex {|row| row =~ /#{c}/}
                x1 = b.map {|row| (row =~ /#{c}/) || w}.min
                x2 = b.map {|row| w - 1 - (row.reverse =~ /#{c}/ || w)}.max
                (y1..y2).each do |i| 
                    (x1..x2).each do |j| 
                        if b[i][j] == c
                            b[i][j] = ??
                        elsif b[i][j] != ??
                            throw :exit
                        end
                    end
                end
            end
            safe = true
            throw :exit
        end
        break if safe
    end 
    puts safe ? 'SAFE' : 'SUSPICIOUS'
end