### subroutines

def over?(ovws, m, i, k)
  for j in (0...m)
    if ovws[i][j]
      return true if j == k
      return true if over?(ovws, m, j, k)
    end
  end
  false
end

### main

n = gets.to_i

n.times do
  h, w = gets.split.map(&:to_i)
  lines = Array.new(h){gets.strip}
  
  m = 0
  mchs = []
  mchhash = {}
  mrects = []

  for y in (0...h)
    for x in (0...w)
      ch = lines[y][x]
      if ch >= 'A' && ch <= 'Z'
        if mchhash[ch].nil?
          mchhash[ch] = m
          mchs[m] = ch
          mrects[m] = [x, y, x, y]
          m += 1
        end

        k = mchhash[ch]
        mrects[k][0] = x if mrects[k][0] > x
        mrects[k][1] = y if mrects[k][1] > y
        mrects[k][2] = x if mrects[k][2] < x
        mrects[k][3] = y if mrects[k][3] < y
      end
    end
  end
  #p mrects

  ovws = Array.new(m){Array.new(m){false}}
  ok = true

  for i in (0...m)
    mch = mchs[i]
    x0, y0, x1, y1 = mrects[i]
    for y in (y0..y1)
      for x in (x0..x1)
        ch = lines[y][x]
        if ch != mch
          if ch == '.'
            ok = false
            break
          end

          k = mchhash[ch]
          if over?(ovws, m, k, i)
            ok = false
            break
          end
          ovws[i][k] = true
        end
      end

      break if ! ok
    end
  end

  puts ok ? "SAFE" : "SUSPICIOUS"
end