INF = 1<<29
N = 26
def check(bag, h, w)
  t = {}; b = {}; l = {}; r = {}; arr = []
  for y in (0...h)
    for x in (0...w)
      unless (c = bag[y][x]) == "."
        if arr.include?(c)
          t[c] = [t[c], y].min; b[c] = [b[c], y].max
          l[c] = [l[c], x].min; r[c] = [r[c], x].max
        else t[c] = y; b[c] = y; l[c] = x; r[c] = x; arr << c
        end
      end
    end
  end
  d = N.times.map{ [INF] * N }
  arr.each do |c|
    (t[c]..b[c]).each do |y|
      (l[c]..r[c]).each do |x|
        if bag[y][x] == "." then return false
        else 
          p = c.ord - "A".ord
          q = bag[y][x].ord - "A".ord
          d[p][q] = (c == bag[y][x]) ? 0 : -1
        end
      end
    end
  end
  (0...N).each do |i|
    (0...N).each do |j|
      (0...N).each do |k|
        d[j][k] = [d[j][k], d[j][i] + d[i][k]].min
      end
    end
  end
  (0...N).all?{|i| d[i][i] >= 0}
end
gets.to_i.times do
  h, w = gets.split.map(&:to_i)
  bag = h.times.map{ gets.chomp.split("") }
  if check(bag, h, w) then puts "SAFE"
  else puts "SUSPICIOUS"
  end
end