import Control.Monad
import Data.List

type Region = (Int, Int, Int, Int)

main = do
  n <- liftM read getLine
  replicateM n analyze

analyze = do
  [h, w] <- liftM (map read . words) getLine
  image <- getImage h w
  let tiles = nub $ concat $ image
  let loops = any (\a -> overlayLoops image tiles a []) tiles
  putStrLn $ if loops then "SUSPICIOUS" else "SAFE"

overlayLoops image tiles a visited =
  any (\b -> b `elem` visited || overlayLoops image tiles b (b:visited)) $ filter (\b -> overlays image b a) $ filter ((/=) a) tiles

-- a overlays b
overlays :: [[Char]] -> Char -> Char -> Bool
overlays image a b =
  let y0 = minimum $ findIndices (elem b) image
      y1 = maximum $ findIndices (elem b) image
      x0 = minimum $ concatMap (elemIndices b) image
      x1 = maximum $ concatMap (elemIndices b) image
  in a `elem` [ image !! y !! x | y <- [y0..y1], x <- [x0..x1] ]

getImage h w = do
  replicateM h getLine