Problem:
 Score: 300 points    Problem Statement  In the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc. The pyramid had center coordinates  (C_X, C_Y) and height  H . The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_Y|, 0) .  Aoki, an explorer, conducted a survey to identify the center coordinates and height of this pyramid. As a result, he obtained the following information:   C_X, C_Y was integers between 0 and 100 (inclusive), and H was an integer not less than 1 .  Additionally, he obtained N pieces of information. The i -th of them is: "the altitude of point (x_i, y_i) is h_i ."   This was enough to identify the center coordinates and the height of the pyramid. Find these values with the clues above.      Constraints   N is an integer between 1 and 100 (inclusive).  x_i and y_i are integers between 0 and 100 (inclusive).  h_i is an integer between 0 and 10^9 (inclusive).  The N coordinates (x_1, y_1), (x_2, y_2), (x_3, y_3), ..., (x_N, y_N) are all different.  The center coordinates and the height of the pyramid can be uniquely identified.         Input  Input is given from Standard Input in the following format:  N  x_1  y_1  h_1  x_2  y_2  h_2  x_3  y_3  h_3  :  x_N  y_N  h_N       Output  Print values C_X, C_Y and H representing the center coordinates and the height of the pyramid in one line, with spaces in between.        Sample Input 1 4
2 3 5
2 1 5
1 2 5
3 2 5      Sample Output 1 2 2 6  In this case, the center coordinates and the height can be identified as (2, 2) and 6 .       Sample Input 2 2
0 0 100
1 1 98      Sample Output 2 0 0 100  In this case, the center coordinates and the height can be identified as (0, 0) and 100 . Note that C_X and C_Y are known to be integers between 0 and 100 .       Sample Input 3 3
99 1 191
100 1 192
99 0 192      Sample Output 3 100 0 193  In this case, the center coordinates and the height can be identified as (100, 0) and 193 .

Solution (Python):
import sys
n=int(input())
s=[[int(i) for i in l.split()] for l in sys.stdin]
for cx in range(101):
  for cy in range(101):
    flag=True
    Z=10**18
    for i in range(n):
      x,y,h=s[i]
      if h!=0 and flag:
        H=abs(x-cx)+abs(y-cy)+h
        flag=False
      elif h!=0 and flag==False:
        if H!=abs(x-cx)+abs(y-cy)+h:
          H=10**18+1
          break
      elif h==0:
        Z=min(Z,abs(x-cx)+abs(y-cy)+h)
    if H<=Z:
      print(cx,cy,H)
      exit()

Solution (Python):
import sys
n=int(input())
s=[[int(i) for i in l.split()] for l in sys.stdin]
for cx in range(101):
  for cy in range(101):
    Z=10**18
    flag=True
    for i in range(n):
      x,y,h=s[i]
      if h!=0:
        if flag:
          H=abs(x-cx)+abs(y-cy)+h
          flag=False
        else:
          if H!=abs(x-cx)+abs(y-cy)+h:
            H=10**18+1
            break
      else:
        Z=min(Z,abs(x-cx)+abs(y-cy))
    if H<=Z:
      print(cx,cy,H)
      exit()

Solution (Python):
import sys
n=int(input())
s=[[int(i) for i in l.split()] for l in sys.stdin]
for cx in range(101):
  for cy in range(101):
    H=[]
    Z=[]
    for i in range(n):
      x,y,h=s[i]
      if h!=0:
        H.append(abs(x-cx)+abs(y-cy)+h)
      else:
        Z.append(abs(x-cx)+abs(y-cy))
    if len(Z)==0:
      Z.append(10**18)
    if H.count(H[0])==len(H) and min(Z)>=H[0]:
      print(cx,cy,H[0])
      exit()

Solution (Python):
from operator import itemgetter

N = int(input())
xyh = [[int(i) for i in input().split()] for _ in range(N)]

xyh.sort(key = itemgetter(2))
tx, ty, th = xyh[-1]
for Cx in range(101):
  for Cy in range(101):
    H = th + abs(tx-Cx) + abs(ty-Cy)
    if all(h == max(H-abs(x-Cx)-abs(y-Cy), 0) for x, y, h in xyh):
      print(Cx, Cy, H)
      exit()

Solution (Python):
N = int(input())
xyh = [list(map(int,input().split())) for _ in range(N)]
if N == 1:
    print(xyh[0][0],xyh[0][1],xyh[0][2])
    exit()

for cx in range(101):
    for cy in range(101):
        H = set()
        d = []
        for x,y,h in xyh:
            if h >= 1:
                H.add(abs(x-cx)+abs(y-cy)+h)
            else:
                d.append(abs(x-cx)+abs(y-cy))

        if len(H) == 1:
            if len(d) == 0 or list(H)[0] <= min(d):
                print(cx,cy,list(H)[0])
                exit()

Solution (Python):
N = int(input())
D = [list(map(int, input().split())) for _ in range(N)]
if N==1:
    print(D[0][0],D[0][1],D[0][2])
    exit()
H={}
for cx in range(101):
    for cy in range(101):
        H=set()
        d = []
        for x, y, h in D:
            if h >=1:
                H.add(abs(x-cx)+abs(y-cy)+h)
            else:
                d.append(abs(x-cx)+abs(y-cy))

        if len(H)==1:
            if len(d)==0 or list(H)[0] <= min(d):
                print(cx, cy, list(H)[0])
                exit()

Solution (Python):
import sys
from operator import itemgetter
sys.setrecursionlimit(10**7)
N = int(input())
li = [[int(x) for x in input().split()] for _ in range(N)]
li.sort(key=itemgetter(2),reverse=True)
map = [[-1 for _ in range(101)] for _ in range(101)]
ans = [0]*3
for i in range(101):
    for j in range(101):
        h = -1
        flag = True
        for x in li:
            if(h == -1):
                h=x[2]+abs(x[0]-i)+abs(x[1]-j)
            else:
                if(x[2]!=0):
                    if(h!=x[2]+abs(x[0]-i)+abs(x[1]-j)):
                        flag = False
                else:
                    if(h>abs(x[0]-i)+abs(x[1]-j)):
                        flag = False
        if(flag):
            if(h>ans[2]):
                ans=[i,j,h]

print(str(ans[0])+' '+str(ans[1])+' '+str(ans[2]))

Solution (Python):

N = int(input())
l = []
for i in range(N):
    a = list(map(int, input().split()))
    if a[2] > 0:
      l.append(a)
if len(l) >= 2:
    for i in range(len(l)-1):
        ans = []
        for cx in range(101):
            for cy in range(101):
                if l[i][2] + abs(l[i][0] - cx) + abs(l[i][1] - cy) == l[i+1][2] + abs(l[i+1][0] - cx) + abs(l[i+1][1] - cy):
                    if i == 0:
                        ans.append([cx, cy])
                    else:
                        if [cx, cy] in ansn:
                            ans.append([cx, cy])
        ansn = ans[:]
        if len(ans) == 1:
            break
    print(ans[0][0], ans[0][1], l[0][2] + abs(l[0][0] - ans[0][0]) + abs(l[0][1] - ans[0][1]))
else:
    print(l[0][0], l[0][1], l[0][2])

Solution (Python):

N = int(input())
l = []
for i in range(N):
    a = list(map(int, input().split()))
    if a[2] > 0:
      l.append(a)
if len(l) >= 2:
    for i in range(len(l)-1):
        ans = []
        for cx in range(101):
            for cy in range(101):
                if l[i][2] + abs(l[i][0] - cx) + abs(l[i][1] - cy) == l[i+1][2] + abs(l[i+1][0] - cx) + abs(l[i+1][1] - cy) and l[i][2] != 0 and l[i+1][2] != 0:
                    if i == 0:
                        ans.append([cx, cy])
                    else:
                        if [cx, cy] in ansn:
                            ans.append([cx, cy])
        ansn = ans[:]
        if len(ans) == 1:
            break
    print(ans[0][0], ans[0][1], l[0][2] + abs(l[0][0] - ans[0][0]) + abs(l[0][1] - ans[0][1]))
else:
    print(l[0][0], l[0][1], l[0][2])

Solution (Python):
n=int(input())
l=[[] for i in range(n)]
for i  in range(n):
    l[i]=list(map(int,input().split()))
xy=[[] for i in range(101**2)]
k=0
for x in range(101):
    for y in range(101):
        xy[k]=[x,y]
        k+=1
for i in l:
    for j in l:
        tmp=[]
        if i==j:
            continue
        for z in xy:
            if abs(i[0]-z[0])-abs(j[0]-z[0])+abs(i[1]-z[1])-abs(j[1]-z[1])==j[2]-i[2] and i[2]!=0 and j[2]!=0:
                tmp.append(z)
            elif abs(i[0]-z[0])-abs(j[0]-z[0])+abs(i[1]-z[1])-abs(j[1]-z[1])>=j[2]-i[2] and i[2]==0:
                tmp.append(z)
            elif abs(i[0]-z[0])-abs(j[0]-z[0])+abs(i[1]-z[1])-abs(j[1]-z[1])<=j[2]-i[2] and j[2]==0:
                tmp.append(z)
        xy=tmp[:]
        if len(xy)==1:
            break
    if len(xy)==1:
            break
for i in l:
    if i[2]!=0:
        H=i[2]+abs(i[0]-xy[0][0])+abs(i[1]-xy[0][1])
print(xy[0][0],xy[0][1],H)

Solution (Python):

import sys
input = sys.stdin.readline

N = int(input())
X,Y,H = [],[],[]
for i in range(N):
 x,y,h = map(int,input().split())
 if(h != 0):
  X.append(x),Y.append(y),H.append(h)

Cx,Cy = [],[]
for i in range(101):
  for j in range(101):
    Cx.append(i),Cy.append(j)

if(len(X) == 1):
  print(X[0],Y[0],H[0])
else:
 
 ans_cx,ans_cy,ans_h = 0,0,0
 for i in range(101*101): 
  judge = 1 
  for j in range(len(X)):
   if(j == 0): 
     ans_H = H[j] + abs(X[j]-Cx[i]) + abs(Y[j]-Cy[i])
   else:
     tmp_H = H[j] + abs(X[j]-Cx[i]) + abs(Y[j]-Cy[i])
     if(ans_H != tmp_H):
       judge = 0
       break
  if(judge == 1):
    ans_cx,ans_cy = Cx[i],Cy[i]
    break

 print(ans_cx,ans_cy,ans_H)

Solution (Python):
N = int(input())
xyh = []
X = 0
Y = 1
H = 2
for i in range(N):
    xyh.append(list(map(int, input().split())))

ng = 0
MAX = 101
estH = -1
newH = -1
for x in range(MAX):
    for y in range(MAX):
        for xyhi in xyh:
            if(xyhi[H] > 0):
                newH = xyhi[H] + abs(x - xyhi[X]) + abs(y - xyhi[Y])

                if(estH < 0):
                    estH = newH
                elif(estH != newH):
                    ng = 1
                    break
        if(1 == ng):

            ng = 0
            estH = -1
            continue
        for xyhi in xyh:
            if(xyhi[H] == 0):
                if(estH > abs(x - xyhi[X]) + abs(y - xyhi[Y])):
                    ng = 1
                    break
        if(1 == ng):

            ng = 0
            estH = -1
            continue
        print("{} {} {}".format(x, y, estH))
        exit()

Solution (Python):


N = int(input())
xyh = []
for _ in range (N):
    xyh.append([int(x) for x in input().split()])

count = 0
while True:
    if xyh[count][2] > 0:
        xstd = xyh[count][0]
        ystd = xyh[count][1]
        hstd = xyh[count][2]
        break
    else:
        count += 1

for x in range (101):
    for y in range (101):
        Cx = x
        Cy = y
        H = hstd + abs(xstd-Cx) + abs (ystd - Cy)
        xyhcand = []
        for k in range (N) :
            xi = xyh[k][0]
            yi = xyh[k][1]
            h = max(H-abs(xi-Cx)-abs(yi-Cy),0)
            xyhls = [xi,yi,h]
            xyhcand.append(xyhls)
            xyhls = []
        if sorted(xyh) == sorted(xyhcand):
            ans = " ".join([str(x),str(y),str(H)])
            break
        
print(ans)

Solution (Python):
import numpy as np
N=int(input())
info = np.array([input().split() for _ in range(0, N)], dtype='int')
info = info[np.argsort(info[:,2])][::-1]
start_x = info[0,:][0]
start_y = info[0,:][1]
start_h = info[0,:][2]

for Cx in range(101):
    for Cy in range(101):
        H = start_h+abs(start_x-Cx)+abs(start_y-Cy)
        if all(max(0,H-abs(x-Cx)-abs(y-Cy))==h for x,y,h in info):
            print(Cx,Cy,H)
            break
        else:
            continue
        break

Solution (Python):
N = int(input())
data = [list(map(int,input().split())) for _ in range(N)]
data.sort(key=lambda x:-x[2])

def get_H(data,Cx,Cy):
    x,y,h = data
    return h+abs(x-Cx)+abs(y-Cy) , h==0
def estimate_H(data,Cx,Cy):
    H,_ = get_H(data[0],Cx,Cy)
    for cur_data in data[1:]:
        tmp,isZero = get_H(cur_data,Cx,Cy)
        if isZero and H <= tmp:
            continue
        if H != tmp:
            break
    else:
        return H
    return None

for Cx in range(101):
    for Cy in range(101):
        tmp = estimate_H(data,Cx,Cy)
        if tmp != None:
            print(Cx,Cy,tmp)
            break

Solution (Python):
n = int(input())
xyh = [list(map(int,input().split())) for i in range(n)]
xyh = sorted(xyh,key = lambda x:-x[2])
mx,my,mh = xyh[0]
for cx in range(101):
	for cy in range(101):
		H = mh+abs(mx-cx)+abs(my-cy)
		if all(h == max(0,H-abs(x-cx)-abs(y-cy))for x,y,h in xyh):
			print(cx,cy,H)
			exit()

Solution (Python):

from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007
sys.setrecursionlimit(1000000)


def A():
    return


def B():
    return


def C():
    n = I()
    a = LIR(n)
    if n == 1:
        print(*a[0])
        quit()
    for cy in range(101):
        for cx in range(101):
            for i in range(n):
                x,y,h = a[i]
                if h > 0:
                    H = abs(x-cx)+abs(y-cy)+h
                    break
            f = True
            for i in range(n):
                x,y,h = a[i]
                if max(H-abs(x-cx)-abs(y-cy),0) != h:
                    f = False
                    break
            if f:
                print(cx,cy,H)
                quit()

def D():
    return


def E():
    return


def F():
    return


def G():
    return


def H():
    return


if __name__ == "__main__":
    C()

Solution (Python):
N = int(input().strip())

points = []

for i in range(0,N):
    points.append(list(map(int, input().strip().split())))

for cx in range(0,101):
    for cy in range(0,101):
        for p in points:
            if p[2] > 0:
                target = p
                break
        H = (target[2] + abs(target[0] - cx) + abs(target[1] - cy))
        if all([points[i][2] == max(H - (abs(points[i][0] - cx) + abs(points[i][1] - cy)),0) for i in range(0,N)]):
            res = [cx,cy,H]
            break


print(res[0],res[1],res[2])

Solution (Python):
n=int(input())
p=[list(map(int,input().split()))for _ in range(n)] 
ax,ay,ah=list(filter(lambda x:x[2],p))[0] 
for x in range(101):
    for y in range(101):
        H=ah+abs(ax-x)+abs(ay-y) 
        if all([max(H-abs(t[0]-x)-abs(t[1]-y),0)==t[2]for t in p]): 
            print(x,y,H)

Solution (Python):
n = int(input())
XYH = []

for _ in range(n):
    x,y,h = map(int,input().split())
    if h != 0:
        XYH.append([x,y,h])

flag = False
ans = XYH[0]
for i in range(101):
    for j in range(101):
        tempH = abs(XYH[0][0] - i) + abs(XYH[0][1] - j) + XYH[0][2]
        for x,y,h in XYH[1:]:
            if abs(x - i) + abs(y - j) + h != tempH:
                flag = False
                break
            else:
                flag = True
        if flag:
            ans = [i,j,tempH]
            break
    if flag:
        break

print(*ans,sep = " ")

Solution (Python):
A=abs;n=int(input());p=eval('list(map(int,input().split())),'*n);x,y,h=[x for x in p if x[2]][0]
for I in range(10201):j,i=I//101,I%101;H=h+A(x-j)+A(y-i);print(*(j,i,H)*all(u==max(H-A(s-j)-A(t-i),0)for s,t,u in p))

Solution (Python):
N = input()
x = [0]*N
y = [0]*N
h = [0]*N
for i in range(N):
  x[i], y[i], h[i] = map(int, raw_input().split())

for p in range(N):
  if h[p]>0:
    for Cy in range(101):
      for Cx in range(101):
        H = h[p] + abs(x[p]-Cx) + abs(y[p]-Cy)
        for i in range(N):
          if max(H-abs(x[i]-Cx)-abs(y[i]-Cy), 0) != h[i]:
            break
        else:
          print Cx, Cy, H
          exit(0)

Solution (Python):

A=abs;n=int(input());p=eval('list(map(int,input().split())),'*n);x,y,h=[x for x in p if x[2]][0]
for I in range(10201):j,i=I//101,I%101;H=h+A(x-j)+A(y-i);print(*(j,i,H)*all(u==max(H-A(s-j)-A(t-i),0)for s,t,u in p))

Solution (Python):

n=int(input());p=eval('list(map(int,input().split())),'*n);x,y,h=[x for x in p if x[2]][0]
for I in range(10201):j,i=I//101,I%101;H=h+abs(x-j)+abs(y-i);print(*(j,i,H)*all(u==max(H-abs(s-j)-abs(t-i),0)for s,t,u in p))

Solution (Python):

n=int(input());p=eval('list(map(int,input().split())),'*n);x,y,h=[x for x in p if x[2]][0]
for I in range(10201):j,i=I//101,I%101;H=h+abs(x-j)+abs(y-i);print(*(j,i,H)*all(max(H-abs(t[0]-j)-abs(t[1]-i),0)==t[2]for t in p))

Solution (Python):
N = int(input())
XYH = sorted([list(map(int, input().split())) for i in range(N)], key=lambda x: x[2], reverse=True)


for cx in range(0, 101):
    for cy in range(0, 101):
        flag = 1
        x, y, h = XYH[0]
        H = h + abs(x - cx) + abs(y - cy)
        for n in range(1, N):
            xn, yn, hn = XYH[n]
            if hn != max(H-abs(xn-cx)-abs(yn-cy), 0):
                flag = 0
        if flag == 1:
            print(cx, cy, H)
            quit()

Solution (Python):
N = int(input())
p = [0, 0, 0]*N

p = [list(map(int, input().split())) for _ in range(N)]
p = sorted(p, key=lambda x:-x[2])
for cx in range(101):
	for cy in range(101):
		H = abs(p[0][0]-cx)+abs(p[0][1]-cy)+p[0][2]
		for i in range(N):
			
			if p[i][2] != max(H-abs(p[i][0]-cx)-abs(p[i][1]-cy), 0):
				break
			if i == N-1:
				ans = [cx, cy, H]
				break
print(ans[0],ans[1],ans[2])

Solution (Python):
import numpy as np

N = int(input())

point = [[int(item) for item in input().split()] for _ in range(N)]
point.sort(key=lambda x:x[2], reverse=True)

ans = np.zeros((101, 101))

for i, p in enumerate(point):
  if i == 0:
    for j in range(101):
      for k in range(101):
        H = p[2] + abs(j - p[0]) + abs(k - p[1])
        ans[j, k] = H
  else:
    for j in range(101):
      for k in range(101):
        if not ans[j,k] == 0:
          if ans[j,k] != p[2] + abs(j - p[0]) + abs(k - p[1]):
            ans[j,k] = 0
  if len(ans[ans!=0]) <= 1:
    break

x, y = np.where(ans!=0)
print(x[0], y[0], int(ans[x[0],y[0]]))

Solution (Python):
n = int(input())
xyh = sorted([list(map(int,input().split())) for i in range(n)],key=lambda x:x[2])[::-1]
flag = 0
for x in range(101):
    for y in range(101):
        H = abs(xyh[0][0]-x) + abs(xyh[0][1]-y)+xyh[0][2]
        for i in range(n):
            if not((xyh[i][2] == 0 and H - abs(xyh[i][0]-x) - abs(xyh[i][1]-y) <= 0) or H - abs(xyh[i][0]-x) - abs(xyh[i][1]-y) == xyh[i][2]):
                break
            if i == n-1:
                flag = 1
        if flag == 1:
            ans = [x,y,H]
            break
    if flag == 1:
        break
print(str(ans[0])+" "+str(ans[1])+" "+str(ans[2]))

Solution (Python):
N = int( input())
X = [ list( map( int, input().split())) for _ in range(N)]
for j in range(N):
    if X[j][2] != 0:
        k = j
        break
A = X[j]


for cx in range(101):
  for cy in range(101):
    H = A[2] + abs(A[0] - cx) + abs(A[1] - cy)
    flag = True
    for i in range(N):
      if max(H - abs(X[i][0]-cx) - abs(X[i][1] - cy), 0) != X[i][2]:
        flag = False
        break
    if flag:
      print(cx,cy,H)
      break
  if flag:
    break

Solution (Python):
import sys
 
N = int(input())
infos = [list(map(int, input().rstrip().split(' '))) + [i] for i in range(N)]
infos = sorted(infos, key=lambda x: x[2])[::-1]

if N == 1:
    print(infos[0][0], infos[0][1], infos[0][2])
    sys.exit()

for cy in range(100 + 1):
    for cx in range(100 + 1):
        pseudo_h1 = abs(infos[0][0] - cx) + abs(infos[0][1] - cy) + infos[0][2]
 
        flag_assumpt = True
        for info in infos[1:]:
            pseudo_h2 = abs(info[0] - cx) + abs(info[1] - cy) + info[2]
            
            if info[2] == 0:
                if abs(info[0] - cx) + abs(info[1] - cy) < pseudo_h1:
                    flag_assumpt = False
                    break
                
            elif pseudo_h1 != pseudo_h2:
                flag_assumpt = False
                break
        
        if flag_assumpt:
            print(cx, cy, pseudo_h1)
            sys.exit()

Solution (Python):
N=int(input())
a=[list(map(int,input().split())) for i in range(N)]
flag=False
for cx in range(101):
    if flag:
        break
    for cy in range(101):
        count=0
        if flag:
            break
        for i in range(N):
            if a[i][2]!=0:
                if count==0:
                    H=a[i][2]+abs(cx-a[i][0])+abs(cy-a[i][1])
                    count+=1
                if H!=a[i][2]+abs(cx-a[i][0])+abs(cy-a[i][1]):
                    break
            if i==N-1:
                x=cx
                y=cy
                flag=True
                for k in range(N):
                    if a[k][2]!=max(H-abs(x-a[k][0])-abs(y-a[k][1]),0):
                        flag=False
print(x,y,H)

Solution (Python):
n=int(input())
xyh=[]
h0=[]
for i in range(n):
    a=[int(j) for j in input().split()]
    xyh.append(a)

from operator import itemgetter
xyh.sort(key=itemgetter(2))
xyh.reverse()

for x in range(101):
    for y in range(101):
        p=0
        l=max(0,xyh[0][2]+abs(x-xyh[0][0])+abs(y-xyh[0][1]))
        for i in range(n):
            if xyh[i][2]==0:
                if l>abs(x-xyh[i][0])+abs(y-xyh[i][1]):
                    p=1
                    break
                else:
                    continue
            if l==max(0,xyh[i][2]+abs(x-xyh[i][0])+abs(y-xyh[i][1])):
                l=max(0,xyh[i][2]+abs(x-xyh[i][0])+abs(y-xyh[i][1]))
            else:
                p=1
                break
        if p==0:
            print(x,y,l)
            import sys
            sys.exit()

Solution (Python):
n = int(input())
e = sorted([[int(i) for i in input().split()] for i in range(n)], key=lambda x:x[2])[::-1]

def f():
    for x in range(101):
        for y in range(101):
            flg = True
            H = e[0][2] + abs(x-e[0][0]) + abs(y-e[0][1])
            for e_ in e:
                if (e_[2] == 0):
                    if H > abs(x-e_[0]) + abs(y-e_[1]):
                        flg = False
                        break
                    else:
                        continue
                
                if H != e_[2] + abs(x-e_[0]) + abs(y-e_[1]):
                    flg = False
                    break
            if flg:
                return (x, y, H)
result = f()
print("{} {} {}".format(result[0], result[1], result[2]) )

Solution (Python):
N=int(input())
L=[list(map(int,input().split())) for i in range(N)]
x=[]
y=[]
h=[]
for l in L:
    x.append(l[0])
    y.append(l[1])
    h.append(l[2])
Cx=0
Cy=0
H=0

for i in range(101):
    for j in range(101):
        flag=True
        for k in range(N):
            if h[k]!=0:
                H=h[k]+abs(i-x[k])+abs(j-y[k])
                break

        for k in range(N):
            if h[k]!=max(H-abs(i-x[k])-abs(j-y[k]),0):
                flag=False
                break
        
        if flag==True:
            Cx,Cy=i,j
            break
    if flag==True:
        break
print("{} {} {}".format(Cx,Cy,H))

Solution (Python):
N = int(input())
xyh = [list(map(int,input().split())) for _ in range(N)]
xyh = sorted(xyh, key = lambda x:-x[2])
mx, my, mh = xyh[0]
for Cx in range(101):
  for Cy in range(101):
    H = mh+abs(mx-Cx)+abs(my-Cy)
    if(all(h == max(0, H-abs(x-Cx)-abs(y-Cy)) for x,y,h in xyh)):
      print(Cx,Cy,H)
      exit()

Solution (Python):

import sys
import numpy as np


def solve(N: int, x: "List[int]", y: "List[int]", h: "List[int]"):
    
    
    
    
    
    
    candi = 0
    for i in range(N):
        if h[i] == 0:
            continue
        else:
            candi = i
    for i in range(101):
        for j in range(101):
            flag = 1
            candh = h[candi] + abs(x[candi]-i) + abs(y[candi]-j)
            
            for xx, yy, hh in zip(x, y, h):
                
                if hh != max(candh-abs(xx-i)-abs(yy-j), 0):
                    flag = 0
                    break
            if flag == 1:
                
                break
        if flag == 1:
            break
    trueh = h[candi] + abs(x[candi]-i) + abs(y[candi]-j)
    print(i, j, trueh)
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    x = [int()] * (N)  
    y = [int()] * (N)  
    h = [int()] * (N)  
    for i in range(N):
        x[i] = int(next(tokens))
        y[i] = int(next(tokens))
        h[i] = int(next(tokens))
    solve(N, x, y, h)


if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
X = []
Y = []
H = []
ansx = 0
ansy = 0
ansh = 0
for _ in range(N):
    x,y,h = map(int,input().split())
    X.append(x)
    Y.append(y)
    H.append(h)

for cx in range(101):
    for cy in range(101):
        center_height = 0
        for i in range(N):
            if H[i] != 0:
                center_height = H[i] + abs(X[i]-cx) + abs(Y[i]-cy)
                break
        
        ok = True
        for i in range(N):
            if H[i] == 0 and center_height - abs(X[i]-cx) - abs(Y[i]-cy)>0:
                ok = False
            if H[i] > 0 and center_height != H[i] + abs(X[i]-cx) + abs(Y[i]-cy):
                ok = False

        if ok is True:
            ansx = str(cx)
            ansy = str(cy)
            ansh = str(center_height)


print(ansx + ' ' + ansy + ' ' + ansh)

Solution (Python):
N = int(input())

SIZE = 101

base_data = None
data = []
for i in range(N):
    d = list(map(int, input().split()))
    data.append(d)
    if d[2] > 0:
        base_data = d
for x in range(SIZE):
    for y in range(SIZE):
        H = max(base_data[2] + abs(base_data[0] - x) + abs(base_data[1] - y), 0)
        all = True
        for d in data:
            h = max(H - abs(d[0] - x) - abs(d[1] - y), 0)
            if h != d[2]:
                all = False
                break
        if all:
            print(str(x) + " " + str(y) + " " + str(H))
            exit()

Solution (Python):
import sys

N = int(input())

xn = []
yn = []
hn = []

for i in range(N):
    xi, yi, hi = map(int, input().split())

    xn.append(xi)
    yn.append(yi)
    hn.append(hi)

for Cx in range(101):
    for Cy in range(101):

        last = None
        flg = True

        for i in range(N):

            if 0 == hn[i]:
                continue

            H = abs(xn[i] - Cx) + abs(yn[i] - Cy) + hn[i]

            if H < 0:
                continue

            if last:
                if H != last:
                    flg = False
                    break

            last = H

        if not flg:
            continue

        for i in range(N):

            if 0 == hn[i]:
                h = abs(xn[i] - Cx) + abs(yn[i] - Cy)
                if h < H:
                    flg = False
                    break

        if not flg:
            continue

        print(Cx, Cy, H)
        sys.exit()

Solution (Python):
n = int(input())
x = []
y = []
h = []
for i in range(n):
    x1,y1,h1=[int(i) for i in input().split()]
    x.append(x1) 
    y.append(y1) 
    h.append(h1)

flag = 0
a,b,c = 0,0,0
for i in range(101):
    if flag:
        break
    else:
        for j in range(101):
            if flag:
                break
            else:
                for k in range(n):
                    if h[k] != 0:
                        first = abs(x[k]-i)+abs(y[k]-j)+h[k]
                        break
                ct = 0
                for k in range(n): 
                    tmp = abs(x[k]-i)+abs(y[k]-j)+h[k]
                    if first == tmp or (first < tmp and h[k]==0):
                        ct += 1
                    if ct == n:
                        a,b,c = i,j,first
                        flag = 1

print("{} {} {}".format(a,b,c))

Solution (Python):
import numpy as np
N = int(input())
data = np.zeros((N,3))
for i in range(N):
    data[i] = np.array(input().split())



if len(np.where(data[:,2]!=0)[0]) == 1:
    C_x, C_y, H = map(int,data[np.where(data[:,2]!=0)[0][0]])
    print(C_x, C_y, H)
else:
    for n in range(10201):
        C_x = n // 101
        C_y = n % 101
        correctflg = True
        unsetflg = True
        for x,y,h in data:
            if unsetflg:
                if h >= 1:
                    H = abs(x-C_x)+abs(y-C_y)+h
                    unsetflg = False
            else:
                if h >= 1 and H != abs(x-C_x)+abs(y-C_y)+h:
                    correctflg = False
                    break 
        if correctflg:
            print(C_x,C_y,int(H))
            break

Solution (Python):
def ans():
  N = int(input())
  xyh = [list(map(int,input().split())) for _ in range(N)]
  xyh = sorted(xyh, key = lambda x: -x[2])
  mx, my, mh = xyh[0]
  for Cx in range(101):
    for Cy in range(101):
      H = mh+abs(mx-Cx)+abs(my-Cy)
      if(all(h == max(H-abs(x-Cx)-abs(y-Cy), 0) for x,y,h in xyh)):
        print(Cx, Cy, H)
        exit()
ans()

Solution (Python):
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools


sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]


def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)

N = I()
xyh = []
for i in range(N):
    x, y, h = LI()
    xyh.append([x,y,h])


for i in range(100+1):
    for j in range(100+1):
        cx, cy = i, j
        H = []
        for item in xyh:
            
            if item[2] == 0:
                continue

            new_H = max(item[2] + abs(item[0] - cx) + abs(item[1] - cy), 0)
            H.append(new_H)
        else:
            if len(set(H)) == 1:
                center_H = H[0]
                H = []
                for item in xyh:
                    if item[2] == 0:
                        
                        
                        if center_H - abs(item[0] - cx) - abs(item[1] - cy) > 0:
                        
                            break
                else:
                    print(i, j, center_H)
                    exit()

Solution (Python):
def main():
    N = int(input())

    xn = []
    yn = []
    hn = []

    for i in range(N):
        xi, yi, hi = map(int, input().split())

        xn.append(xi)
        yn.append(yi)
        hn.append(hi)

    for Cx in range(101):
        for Cy in range(101):

            last = None
            flg = True

            for i in range(N):

                if 0 == hn[i]:
                    continue

                H = abs(xn[i] - Cx) + abs(yn[i] - Cy) + hn[i]

                if H < 0:
                    continue

                if last:
                    if H != last:
                        flg = False
                        break

                last = H

            if not flg:
                continue

            for i in range(N):

                if 0 == hn[i]:
                    h = abs(xn[i] - Cx) + abs(yn[i] - Cy)
                    if h < H:
                        flg = False
                        break

            if not flg:
                continue

            print(Cx, Cy, H)
            return


main()