import Data.List
import Text.Printf
getInt = do
    t <- getLine
    return (read t::Integer)

getInts = do
    x <- getLine
    let y = map (read::String->Integer) (words x) 
    return y

getData 1 = do
    [x,y,h] <- getInts
    return [(x,y,h)]

getData n = do
    [x,y,h] <- getInts
    z <- getData (n-1)
    let rt = [(x,y,h)] ++ z
    return rt

nextPyramid (x,y) = if y+1<101 then (x,y+1) else if x+1<101 then (x+1,0) else (-1,-1)

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

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
    n <- getInt
    tbl <- getData n
    let (x,y,h) = solve (0,0) tbl
    printf "%d %d %d\n" x y h