n = gets.to_i
n.times do
    h, w = gets.split.map(&:to_i)
    f = h.times.map{gets.chomp}
    keys = Array.new
    f.each do |r|
        r.each_char do |c|
            keys.push(c) if !keys.include?(c) && c != "."
        end
    end
    if keys.empty?
        puts "SAFE"
        next
    end
    b = true
    rec = Hash.new(Array.new(4))
    f.each_with_index do |row, i|
        row.each_char.with_index do |ch, j|
            if !rec.has_key?(ch)
                rec[ch] = [i,j,i,j]
            else
                rec[ch][0] = i if i < rec[ch][0]
                rec[ch][1] = j if j < rec[ch][1]
                rec[ch][2] = i if i > rec[ch][2]
                rec[ch][3] = j if j > rec[ch][3]
            end
        end
    end
    keys.permutation(keys.size) do |p|
        b = true
        done = Hash.new(false)
        p.each do |c|
            for i in rec[c][0]..rec[c][2]
                for j in rec[c][1]..rec[c][3]
                    if f[i][j] != c && !done[f[i][j]]
                        b = false
                    end
                    break if !b
                end
            end
            break if !b
            done[c] = true
        end
        break if b
    end
    puts b ? "SAFE" : "SUSPICIOUS"
end