import Control.Arrow
import Data.List
import qualified Data.ByteString.Char8 as B
import Control.Monad 
import Data.Maybe

main :: IO ()
main = readLn >>= main'
    where
        main' n = replicateM n breads >>= printRes . solve
        printRes = putStrLn . unwords . map show

solve :: [[Int]] -> [Int]
solve xyhs = fromJust . head . filter isJust $ map calc [(x, y) | x <- [0..100], y <- [0..100]]
    where
        calc (cx, cy) = judge (Left 10000000000) $ map calcH xyhs
            where
                judge (Right ans) (Right v : res)
                    | ans == v = judge (Right v) res
                    | otherwise = Nothing
                judge (Right ans) (Left v : res)
                    | ans <= v = judge (Right ans) res
                    | otherwise = Nothing
                judge (Left ans) (Right v : res)
                    | v <= ans = judge (Right v) res
                    | otherwise = Nothing
                judge (Left ans) (Left v : res) = judge (Left $ min ans v) res
                judge (Right ans) _ = Just [cx,  cy, ans]
                judge _ _ = Nothing

                calcH [x, y, h]
                    | h > 0 = Right $ h + z
                    | otherwise = Left $ z
                    where
                        z = zf x y

                zf x y = abs (x - cx) + abs (y - cy)


breads :: IO [Int]
breads = unfoldr (\s -> second (maybe B.empty snd . B.uncons) <$> B.readInt s) <$> B.getLine