import Data.List
import Text.Printf
nextPyramid (x,y) = if y+1<101 then (x,y+1) else if x+1<101 then (x+1,0) else (-1,-1)
listToTuple [x,y,z] = (-z,x,y)

check::(Integer,Integer)->[(Integer,Integer,Integer)]->Integer->Integer
check (x,y) (d:ds) h
    | h==0 && c/=0 = check (x,y) ds (abs (a-x) + abs (b-y) + c)
    | c==tmp = if ds==[] then h else check (x,y) ds h
    | otherwise = -1
    where
        (g,a,b) = d
        c = -g
        tmp = max (h - abs (a-x) - abs (b-y)) 0

solve (-1,-1) tbl = (-1,-1,-1)
solve (x,y) tbl
    | ans == (0-1) = solve (nextPyramid (x,y)) tbl
    | otherwise = (x,y,ans)
    where
        ans = check (x,y) tbl 0

main::IO()
main=do
    getLine
    tbl <- map (listToTuple.map read.words) . lines <$> getContents :: IO [(Integer,Integer,Integer)]
    let (x,y,h) = solve (0,0) (sort tbl)
    printf "%d %d %d\n" x y h