CodeEff/ECCO huggingface dataset:
# Original solution
# 2019-11-10 20:23:41(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# import numpy as np 

def main():
    n = int(sys.stdin.readline().rstrip())
    info = [[int(x) for x in sys.stdin.readline().split()] for _ in range(n)]
    
    # 基準を決める
    for i in range(n):
        if info[i][2] >= 1:
            x0, y0, h0 = info[i][0], info[i][1], info[i][2]
            break
    # else: すべてのhは h = 0

    for x in range(101):
        for y in range(101):
            H = h0 + abs(x - x0) + abs(y - y0)
            for i in range(n):   # 中心(x, y, H)が条件を満たしているか確認する
                h = max(H - abs(x - info[i][0]) - abs(y - info[i][1]), 0)
                if h != info[i][2]: #　本当に中心なら同じ値になるはず
                    break     # そうでないならこれは正しくない
            else:  # 全ての座標に対して条件を満たしていたなら
                res = [x, y, H]
                for i in range(3):
                    res[i] = str(res[i])
                print((' '.join(res)))
                sys.exit() # 中心は一意に決まるので見つかったらそれ以上調べる必要ない
    
            

if __name__ == "__main__":
    main()

# Optimized solution
import sys

n, *xyh = map(int, sys.stdin.read().split())
xyh = list(zip(*[iter(xyh)] * 3))

def conflict(cx, cy, ch, x, y, h):
    return h != max(ch - abs(x - cx) - abs(y - cy), 0)

def main():
    for x, y, h in xyh:
        if h >= 1:
            xt, yt, ht = x, y, h
            break
    
    for cx in range(101):
        for cy in range(101):
            ch = ht + abs(cx - xt) + abs(cy - yt)
            for x, y, h in xyh:
                if conflict(cx, cy, ch, x, y, h):
                    break
            else:
                return cx, cy, ch

if __name__ == '__main__':
    ans = main()
    print(*ans, sep=' ')
# Original solution
def main():
    N = int(input())
    xyh = [[int(i) for i in input().split()] for _ in range(N)]
    sx, sy, sh = [(x, y, h) for x, y, h in xyh if h != 0][0]
    for cx in range(101):
        for cy in range(101):
            H = sh + abs(sx - cx) + abs(sy - cy)
            if all(max(H-abs(x - cx)-abs(y - cy), 0) == h for x, y, h in xyh):
                return print(cx, cy, H)


if __name__ == '__main__':
    main()


# Optimized solution
def main():
    import sys
    input = sys.stdin.buffer.readline
    N = int(input())
    XYH = [[int(i) for i in input().split()] for j in range(N)]
    XYH.sort(reverse=True, key=lambda p: p[2])

    for cy in range(101):
        for cx in range(101):
            ch = XYH[0][2] + abs(XYH[0][0] - cx) + abs(XYH[0][1] - cy)
            for x, y, h in XYH[1:]:
                if h != max(ch - abs(x - cx) - abs(y - cy), 0):
                    break
            else:
                if ch != 0:
                    return print(cx, cy, ch)
    print(-1)


if __name__ == '__main__':
    main()
# Original solution
ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
INF = 10**18

N=ri()
xyh=[]
for i in range(N):
    xyh += [rl()]
xyh.sort(reverse=True, key=lambda x:x[2])

ans=[-1]*3
for x in range(101):
    if ans[0] != -1:
        break
    for y in range(101):
        if ans[0] != -1:
            break
        if xyh[0][2] == 0:
            h_m = xyh[0][2]+abs(x-xyh[0][0])+abs(y-xyh[0][1])
            for i in range(1,N):
                rst = xyh[i][2]+abs(x-xyh[i][0])+abs(y-xyh[i][1])
                if h_m > rst:
                    h_m = rst
                if h_m == 0:
                    break
                elif i==N-1:
                    ans = [x,y,h_m]
        else:
            h = xyh[0][2]+abs(x-xyh[0][0])+abs(y-xyh[0][1])
            for i in range(1,N):
                if xyh[i][2] != 0:
                    if h != xyh[i][2]+abs(x-xyh[i][0])+abs(y-xyh[i][1]):
                        break
                elif xyh[i][2] == 0:
                    if h > xyh[i][2]+abs(x-xyh[i][0])+abs(y-xyh[i][1]):
                        break
                if i == N-1:
                    ans = [x,y,h]

print("{} {} {}".format(ans[0],ans[1],ans[2]))


# Optimized solution
ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
INF = 10**18

N=ri()
X=[0]*N
Y=[0]*N
H=[0]*N
for i in range(N):
    X[i],Y[i],H[i]=rl()
xyh=list(zip(X,Y,H))
xyh.sort(reverse=True,key=lambda x:x[2])
X,Y,H = zip(*xyh)

ans=[-1]*3
for x in range(101):
    if ans[0] != -1:
        break
    for y in range(101):
        if ans[0] != -1:
            break
        rst = H[0]+abs(x-X[0])+abs(y-Y[0])
        for i in range(1,N):
            if H[i] != 0 and rst != H[i]+abs(x-X[i])+abs(y-Y[i]):
                break
            elif H[i] == 0 and rst > H[i]+abs(x-X[i])+abs(y-Y[i]):
                break
            if i == N-1:
                ans = [x,y,rst]

print("{} {} {}".format(ans[0],ans[1],ans[2]))
# Original solution
n = int(eval(input()))
P = [0] * n
for i in range(n):
    P[i] = list(map(int, input().split()))
P = sorted(P, key=lambda x: x[2], reverse=True)

max_h = P[0][2]

P2 = set()
for i in range(101):
    for j in range(101):
        P2.add((i, j))
for hh in range(max_h+200, max_h-1, -1):
    P3 = P2.copy()
    for x, y, h in P:
        for xx, yy in P3.copy():
            dx = abs(xx - x)
            dy = abs(yy - y)
            th = max(hh-dx-dy, 0)
            if th != h:
                P3.remove((xx, yy))
    if len(P3) == 1:
        xx, yy = P3.pop()
        print(('%d %d %d' % (xx, yy, hh)))


# Optimized solution
import sys
n = int(eval(input()))
P = [0] * n
for i in range(n):
    P[i] = list(map(int, input().split()))
P = sorted(P, key=lambda x: x[2], reverse=True)

max_h = P[0][2]

for hh in range(max_h+200, max_h-1, -1):
    for cx in range(101):
        for cy in range(101):
            for x, y, h in P:
                th = max(hh-abs(cx-x)-abs(cy-y),0)
                if h == th:
                    continue
                else:
                    break
            else:
                print(('%d %d %d' % (cx, cy, hh)))
                sys.exit(0)
# Original solution
import itertools

n = int(input())
x, y, h = [], [], []
for _ in range(n):
    xi, yi, hi = map(int, input().split())
    if hi != 0:
        x.append(xi)
        y.append(yi)
        h.append(hi)
candidate_cx = list(range(min(x), max(x) + 1))
candidate_cy = list(range(min(y), max(y) + 1))
candidate_ch = list(range(max(h), max(max(x) - min(x), max(y) - min(y)) + max(h) + 1))

for cx, cy, ch in list(itertools.product(candidate_cx, candidate_cy, candidate_ch)):
    adapted = True
    for xi, yi, hi in zip(x, y, h):
        if hi != ch - abs(xi - cx) - abs(yi - cy):
            adapted = False
            break
    if adapted == False:
        continue
    print(cx, cy, ch, sep = ' ')
    exit(0)


# Optimized solution
import itertools

n = int(input())
x, y, h = [], [], []
for _ in range(n):
    xi, yi, hi = map(int, input().split())
    if hi != 0:
        x.append(xi)
        y.append(yi)
        h.append(hi)
candidate_cx = list(range(min(x), max(x) + 1))
candidate_cy = list(range(min(y), max(y) + 1))

for cx, cy in list(itertools.product(candidate_cx, candidate_cy)):
    adapted = True
    ch = 0
    for xi, yi, hi in zip(x, y, h):
        ch = max(ch, hi + abs(xi - cx) + abs(yi - cy))
    for xi, yi, hi in zip(x, y, h):
        if hi != ch - abs(xi - cx) - abs(yi - cy):
            adapted = False
            break
    if adapted == False:
        continue
    print(cx, cy, ch, sep = ' ')
    exit(0)
# Original solution
import itertools

n = int(input())
x, y, h = [], [], []
for _ in range(n):
    xi, yi, hi = map(int, input().split())
    if hi != 0:
        x.append(xi)
        y.append(yi)
        h.append(hi)
candidate_cx = list(range(min(x), max(x) + 1))
candidate_cy = list(range(min(y), max(y) + 1))

for cx, cy in list(itertools.product(candidate_cx, candidate_cy)):
    adapted = True
    ch = 0
    for xi, yi, hi in zip(x, y, h):
        ch = max(ch, hi + abs(xi - cx) + abs(yi - cy))
    for xi, yi, hi in zip(x, y, h):
        if hi != ch - abs(xi - cx) - abs(yi - cy):
            adapted = False
            break
    if adapted == False:
        continue
    print(cx, cy, ch, sep = ' ')
    exit(0)


# Optimized solution
import itertools

n = int(input())
x, y, h = [], [], []
for _ in range(n):
    xi, yi, hi = map(int, input().split())
    if hi != 0:
        x.append(xi)
        y.append(yi)
        h.append(hi)
candidate_cx = list(range(min(x), max(x) + 1))
candidate_cy = list(range(min(y), max(y) + 1))

for cx, cy in list(itertools.product(candidate_cx, candidate_cy)):
    adapted = True
    ch = h[0] + abs(x[0] - cx) + abs(y[0] - cy)
    for xi, yi, hi in zip(x, y, h):
        if hi != ch - abs(xi - cx) - abs(yi - cy):
            adapted = False
            break
    if adapted == False:
        continue
    print(cx, cy, ch, sep = ' ')
    exit(0)
# Original solution
N = int(eval(input()))

points = [None] * N
for i in range(0, N):
    points[i] = list(map(int, input().split()))

h_max = max([h for x, y, h in points])

for H in range(h_max + 100, h_max - 1, -1):
    for Cx in range(101):
        for Cy in range(101):
            ok = True
            for X, Y, h1 in points:
                h2 = max(H - abs(X - Cx) - abs(Y - Cy), 0)
                if h1 != h2:
                    ok = False
                    break
            if ok:
                print(('{} {} {}'.format(Cx, Cy, H)))
                exit()


# Optimized solution
N = int(eval(input()))
points = [[int(s) for s in input().split()] for i in range(N)]
h_max = max(h for x, y, h in points)

for H in range(h_max, h_max + 1000):
    for Cx in range(101):
        for Cy in range(101):
            ok = True
            for x, y, h in points:
                h_calc = max(H - abs(x - Cx) - abs(y - Cy), 0)
                if h != h_calc:
                    ok = False
                    break
            if ok:
                print(('{} {} {}'.format(Cx, Cy, H)))
                exit()
# Original solution
N = int(eval(input()))
points = [[int(s) for s in input().split()] for i in range(N)]
h_max = max(h for x, y, h in points)

for H in range(h_max, h_max + 1000):
    for Cx in range(101):
        for Cy in range(101):
            ok = True
            for x, y, h in points:
                h_calc = max(H - abs(x - Cx) - abs(y - Cy), 0)
                if h != h_calc:
                    ok = False
                    break
            if ok:
                print(('{} {} {}'.format(Cx, Cy, H)))
                exit()


# Optimized solution
N = int(eval(input()))
points = [[int(s) for s in input().split()] for i in range(N)]
points.sort(key=lambda x: x[2], reverse=True)

for Cx in range(101):
    for Cy in range(101):
        kouho = set()
        for xi, yi, hi in points:
            if len(kouho) > 1:
                break  # 頂点が一意でない

            if hi > 0:
                """観測点の高さが1以上なら頂点高を予測"""
                kouho.add(hi + abs(xi - Cx) + abs(yi - Cy))
            else:
                """観測点の高さが0なら式を満たしているかチェック"""
                if list(kouho)[0] - abs(xi - Cx) - abs(yi - Cy) > 0:
                    kouho = set()
                    break

        if len(kouho) == 1:
            print(('{} {} {}'.format(Cx, Cy, list(kouho)[0])))
            exit()
# Original solution
N = int(eval(input()))
points = [[int(s) for s in input().split()] for i in range(N)]
points.sort(key=lambda x: x[2], reverse=True)

for Cx in range(101):
    for Cy in range(101):
        kouho = set()
        for xi, yi, hi in points:
            if len(kouho) > 1:
                break  # 頂点が一意でない

            if hi > 0:
                """観測点の高さが1以上なら頂点高を予測"""
                kouho.add(hi + abs(xi - Cx) + abs(yi - Cy))
            else:
                """観測点の高さが0なら式を満たしているかチェック"""
                if list(kouho)[0] - abs(xi - Cx) - abs(yi - Cy) > 0:
                    kouho = set()
                    break

        if len(kouho) == 1:
            print(('{} {} {}'.format(Cx, Cy, list(kouho)[0])))
            exit()


# Optimized solution
N = int(eval(input()))
points = [[int(s) for s in input().split()] for i in range(N)]
points.sort(key=lambda x: x[2], reverse=True)

for Cx in range(101):
    for Cy in range(101):
        H = None
        for xi, yi, hi in points:
            dx = abs(xi - Cx)
            dy = abs(yi - Cy)
            if hi > 0:
                """観測点の高さが1以上なら頂点高を予測"""
                H_calc = hi + dx + dy
                if H is None:
                    H = H_calc
                elif H != H_calc:
                    H = None
                    break  # 頂点高が一意ではない場合はNG
            else:
                """観測点の高さが0なら式を満たしているかチェック"""
                if H > dx + dy:
                    H = None
                    break  # 満たしていない場合はNG

        if H:
            print(('{} {} {}'.format(Cx, Cy, H)))
            exit()
# Original solution
N = int(eval(input()))
XYH = [list(map(int, input().split())) for _ in range(N)]
H_max = max([XYH[i][2] for i in range(N)])

ans = []

# 高さH,中心座標を(Cx, Cy)として総当たりで試す
for H in range(H_max - 200, H_max + 201):
    for Cx in range(0, 101):
        for Cy in range(0, 101):
            count = 0
            for X, Y, h in XYH:
                if h == max(H - abs(X - Cx) - abs(Y - Cy), 0):
                    count += 1
                else:
                    break

            if count == N:
                ans = [str(Cx), str(Cy), str(H)]

print((' '.join(ans)))



# Optimized solution
N = int(eval(input()))
XYH = [list(map(int, input().split())) for _ in range(N)]
H_list= [XYH[i][2] for i in range(N)]
H_max = max(H_list)
H_min = min(H_list)
H_diff = H_max - H_min
ans = []

# 高さH,中心座標を(Cx, Cy)として総当たりで試す
for H in range(H_max - (200 - H_diff), H_max + (201 - H_diff)):
    for Cx in range(0, 101):
        for Cy in range(0, 101):
            count = 0
            for X, Y, h in XYH:
                if h == max(H - abs(X - Cx) - abs(Y - Cy), 0):
                    count += 1
                else:
                    break

            if count == N:
                ans = [str(Cx), str(Cy), str(H)]

print((' '.join(ans)))
# Original solution
# coding:utf-8

INF = float('inf')


def inpl(): return list(map(int, input().split()))


def solve():
    for x in range(101):
        for y in range(101):
            for h in range(h_min, h_min + 201):
                for i in range(N):
                    if D[i][0] != max(h - abs(D[i][1] - x) - abs(D[i][2] - y), 0):
                        break
                else:
                    return x, y, h


if __name__ == '__main__':
    N = int(eval(input()))
    D = []
    for i in range(N):
        x, y, h = inpl()
        D.append([h, x, y])

    h_min = max(D)[0]
    ans = solve()
    print((' '.join(map(str, ans))))


# Optimized solution
# coding:utf-8

INF = float('inf')


def inpl(): return list(map(int, input().split()))


def solve():
    for cx in range(101):
        for cy in range(101):
            ch = D[0][0] + abs(D[0][1] - cx) + abs(D[0][2] - cy)
            for h, x, y in D:
                if h != max(ch - (abs(x - cx) + abs(y - cy)), 0):
                    break
            else:
                return cx, cy, ch


if __name__ == '__main__':
    N = int(eval(input()))
    D = []
    for i in range(N):
        x, y, h = inpl()
        D.append([h, x, y])
    D.sort()
    D.reverse()
    ans = solve()
    print((' '.join(map(str, ans))))
# Original solution
from math import *
from itertools import *
import sys

N = int(eval(input()))
all_input_list = [list(map(int, input().split())) for i in range(N)]
x, y, h = [all_input_list[i] for i in range(N) if all_input_list[i][2] > 0][0]
for cx, cy in product(list(range(101)), list(range(101))):
    flag = 1
    H = h + abs(cx - x) + abs(cy - y)
    for input_list in all_input_list:
        if (input_list[2] != max(H - abs(cx - input_list[0]) - abs(cy - input_list[1]), 0)):
            flag = 0
            break
    if (flag == 1):
        print(("%s %s %s" % (cx, cy, H)))
        sys.exit(0)

# Optimized solution
from math import *
import sys

N = int(eval(input()))
all_input_list = [[int(j) for j in input().split()] for i in range(N)]
x, y, h = [all_input_list[i] for i in range(N) if all_input_list[i][2] > 0][0]
for cx in range(101):
    for cy in range(101):
        flag = 1
        H = h + abs(cx - x) + abs(cy - y)
        for input_list in all_input_list:
            if (input_list[2] != max(H - abs(cx - input_list[0]) - abs(cy - input_list[1]), 0)):
                flag = 0
                break
        if (flag == 1):
            print(("%s %s %s" % (cx, cy, H)))
            sys.exit(0)
# Original solution
from math import *
import sys

N = int(eval(input()))
all_input_list = [[int(j) for j in input().split()] for i in range(N)]
x, y, h = [all_input_list[i] for i in range(N) if all_input_list[i][2] > 0][0]
for cx in range(101):
    for cy in range(101):
        flag = 1
        H = h + abs(cx - x) + abs(cy - y)
        for input_list in all_input_list:
            if (input_list[2] != max(H - abs(cx - input_list[0]) - abs(cy - input_list[1]), 0)):
                flag = 0
                break
        if (flag == 1):
            print(("%s %s %s" % (cx, cy, H)))
            sys.exit(0)

# Optimized solution
from math import *
import sys

N = int(eval(input()))
all_input_list = [list(map(int, input().split())) for i in range(N)]
x, y, h = [all_input_list[i] for i in range(N) if all_input_list[i][2] > 0][0]
for cx in range(101):
    for cy in range(101):
        H = h + abs(cx - x) + abs(cy - y)
        for input_list in all_input_list:
            if (input_list[2] != max(H - abs(cx - input_list[0]) - abs(cy - input_list[1]), 0)):
                break
        else:
            print(("%s %s %s" % (cx, cy, H)))
            sys.exit(0)
# Original solution
from math import *

N = int(eval(input()))
all_input_list = [list(map(int, input().split())) for i in range(N)]
x, y, h = [all_input_list[i] for i in range(N) if all_input_list[i][2] > 0][0]
for cx in range(101):
    for cy in range(101):
        H = h + abs(cx - x) + abs(cy - y)
        for input_list in all_input_list:
            if (input_list[2] != max(H - abs(cx - input_list[0]) - abs(cy - input_list[1]), 0)):
                break
        else:
            print(("%s %s %s" % (cx, cy, H)))
            exit()


# Optimized solution
from math import *
import sys

N = int(eval(input()))
all_input_list = [list(map(int, input().split())) for i in range(N)]
x, y, h = sorted(all_input_list, key=lambda x: x[2])[-1]
for cx in range(101):
    for cy in range(101):
        H = h + abs(cx - x) + abs(cy - y)
        for input_list in all_input_list:
            if (input_list[2] != max(H - abs(cx - input_list[0]) - abs(cy - input_list[1]), 0)):
                break
        else:
            print(("%s %s %s" % (cx, cy, H)))
            sys.exit(0)
# Original solution
import sys


n = int(eval(input()))
xyh = []
for i in range(n):
    xyh.append(list(map(int, input().split())))

for cx in range(0, 101):
    for cy in range(0, 101):
        for H in range(max(1, xyh[0][2] - 201),
                       max(2, xyh[0][2] + 201)):
            is_valid = True
            for i in range(n):
                x, y, h = xyh[i]
                if max(H - abs(x - cx) - abs(y - cy), 0) != h:
                    is_valid = False
                    break
            if is_valid is True:
                print(('{} {} {}'.format(cx, cy, H)))
                sys.exit()


# Optimized solution
import sys


n = int(eval(input()))
xyh = []
for i in range(n):
    xyh.append(list(map(int, input().split())))
    if xyh[-1][2] >= 1:
        G = xyh[-1]

for cx in range(0, 101):
    for cy in range(0, 101):
        hs = []
        x, y, h = G
        H = h + abs(x - cx) + abs(y - cy)
        H = max(H, 0)
        invalid = False
        for i in range(n):
            x, y, h = xyh[i]
            hh = H - abs(x - cx) - abs(y - cy)
            hh = max(hh, 0)
            if hh != h:
                invalid = True
                break
        if invalid is False:
            print(("{} {} {}".format(cx, cy, H)))
            sys.exit()
# Original solution
N = int(eval(input()))
Xs = [list(map(int, input().split(" "))) for _ in range(N)]
"""
input = ["2 3 5","2 1 5","1 2 5","3 2 5"]
input = ["0 0 100", "1 1 98"]
input = ["99 1 191", "100 1 192", "99 0 192"]
Xs = [list(map(int, x.split(" "))) for x in input]
"""

Xs.sort(key=lambda x:x[2], reverse=True)


def solv(Xs):
    for x in range(101):
        for y in range(101):
            h= Xs[0][2]
            Cx = Xs[0][0]
            Cy = Xs[0][1]
            H = h + abs(x - Cx) + abs(y - Cy)
            for i in range(len(Xs)):
                h = max(H - abs(x - Xs[i][0]) - abs(y - Xs[i][1]), 0)
                if h != Xs[i][2]:
                    break
                if i == len(Xs)-1:
                    print(("%d %d %d" % (x, y, H)))
                    exit(0)


solv(Xs)


# Optimized solution
N = int(eval(input()))
Xs = [list(map(int, input().split(" "))) for _ in range(N)]
"""
input = ["2 3 5","2 1 5","1 2 5","3 2 5"]
input = ["0 0 100", "1 1 98"]
input = ["99 1 191", "100 1 192", "99 0 192"]
Xs = [list(map(int, x.split(" "))) for x in input]
"""

Xs.sort(key=lambda x:x[2], reverse=True)


def solv(Xs):
    for x in range(101):
        for y in range(101):
            Cx, Cy, h = tuple(Xs[0])
            H = h + abs(x - Cx) + abs(y - Cy)
            for Cx, Cy, h in Xs:
                if max(H - abs(x - Cx) - abs(y - Cy), 0) != h:
                    break
            else:
                return (x, y, H)


print(("%d %d %d" % solv(Xs)))
# Original solution
N=int(eval(input()))
xyh=[list(map(int, input().split())) for _ in range(N)]
maxh = max([h for _,_,h in xyh])

def find(cx, cy, H):
	for x,y,h in xyh:
		if h != max(H-abs(x-cx)-abs(y-cy), 0):
			return False
	return True

def all():
	for cx in range(101):
		for cy in range(101):
			for H in range(min(1, maxh-200), maxh+201):
				if find(cx, cy, H):
					print(("%d %d %d" % (cx, cy, H)))
					return
	print("NOT FOUND")

all()


# Optimized solution
N=int(eval(input()))
xyh=sorted([list(map(int, input().split())) for _ in range(N)], key=lambda x: x[2], reverse=True)

def find(cx, cy, H):
	for x,y,h in xyh:
		if h != max(H-abs(x-cx)-abs(y-cy), 0):
			return False
	return True

def solve():
	for cx in range(101):
		for cy in range(101):
			x,y,h = xyh[0]
			H = h + abs(x-cx) + abs(y-cy)
			if find(cx, cy, H):
				return "%d %d %d" % (cx, cy, H)
	raise Exception

print((solve()))
# Original solution
def c_pyramid(N, Pos):
    from itertools import product
    # 中心座標を全探索
    for cx, cy in product(list(range(101)), repeat=2):
        # ピラミッドの高さを求める
        for x, y, h in Pos:
            if h > 0:
                height = h + abs(cx - x) + abs(cy - y)
        # ピラミッドの高さが得られた情報に適合するか調べる
        for x, y, h in Pos:
            if h != max((height - abs(cx - x) - abs(cy - y)), 0):
                break
        else:
            ans = [cx, cy, height]
            break
    ans = '{0} {1} {2}'.format(*ans)
    return ans

N = int(eval(input()))
Pos = [[int(i) for i in input().split()] for j in range(N)]
print((c_pyramid(N, Pos)))

# Optimized solution
def c_pyramid():
    N = int(eval(input()))
    Pos = [[int(i) for i in input().split()] for j in range(N)]
    # 与えられた情報から頂点座標を一意に得られるので、h=0にならない
    x, y, h = sorted(Pos, key=lambda x: x[2])[-1]
    # 中心座標を全探索
    for cx in range(101):
        for cy in range(101):
            # 頂点の高さ height を決めたとき、すべての座標の情報と一致するか？
            height = h + abs(x - cx) + abs(y - cy)  # 定義式から逆算
            if all(h_i == max(height - abs(x_i - cx) - abs(y_i - cy), 0)
                   for x_i, y_i, h_i in Pos):
                return '{} {} {}'.format(cx, cy, height)  # すべて一致した。これが解
    return None

print((c_pyramid()))