AtCoder Beginner Contest 112 - Pyramid

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-----
4
2 3 5
2 1 5
1 2 5
3 2 5

-----Sample Output-----
2 2 6

In this case, the center coordinates and the height can be identified as (2, 2) and 6.

Source: atcoder | Difficulty: EASY


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


N = int(input())
xyh = [tuple(map(int, input().split())) for _ in range(N)]
for x in xyh:
	if x[2] > 0:
		base = x
		break
for i in range(101):
	for j in range(101):
		h = base[2] + abs(i - base[0]) + abs(j - base[1])
		for x in xyh:
			if x[2] != max(h - abs(i - x[0]) - abs(j - x[1]), 0):
				break
		else:
			print(i, j, h)
			exit()


N = int(input())
XYH = [list(map(int, input().split())) for _ in range(N)]
for cy in range(101):
	for cx in range(101):
		ch = None
		for (x, y, h) in XYH:
			if 0 == h:
				continue
			(dy, dx) = (abs(y - cy), abs(x - cx))
			ch = h + dy + dx
		if all([h == max(0, ch - abs(y - cy) - abs(x - cx)) for (x, y, h) in XYH]):
			print(cx, cy, ch)
			exit()


n = int(input())
XYH = sorted([list(map(int, input().split())) for _ in range(n)], key=lambda x: -x[2])
for x in range(101):
	for y in range(101):
		hmax = XYH[0][2] + abs(x - XYH[0][0]) + abs(y - XYH[0][1])
		for i in range(n):
			if max(hmax - abs(x - XYH[i][0]) - abs(y - XYH[i][1]), 0) != XYH[i][2]:
				break
			if i == n - 1:
				print(x, y, hmax)
				return


n = int(input())
xyh = [list(map(int, input().split())) for _ in range(n)]
for (x, y, h) in xyh:
	if h > 0:
		sx = x
		sy = y
		sh = h
		break
for i in range(101):
	for j in range(101):
		th = abs(i - sx) + abs(j - sy) + sh
		for (x, y, h) in xyh:
			if h != max(th - abs(i - x) - abs(j - y), 0):
				break
		else:
			break
	else:
		continue
	break
print(i, j, th)


import sys
import math
from collections import defaultdict, deque, Counter
from copy import deepcopy
from bisect import bisect, bisect_right, bisect_left
from heapq import heapify, heappop, heappush
input = sys.stdin.readline

def RD():
	return input().rstrip()

def F():
	return float(input().rstrip())

def I():
	return int(input().rstrip())

def MI():
	return map(int, input().split())

def MF():
	return map(float, input().split())

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

def TI():
	return tuple(map(int, input().split()))

def LF():
	return list(map(float, input().split()))

def Init(H, W, num):
	return [[num for i in range(W)] for j in range(H)]

def main():
	N = I()
	L = [LI() for i in range(N)]
	for x in range(101):
		for y in range(101):
			max_num = float('inf')
			ans = 0
			res = True
			for (xn, yn, hn) in L:
				if hn == 0:
					max_num = min(max_num, abs(x - xn) + abs(y - yn))
					if max_num == 0:
						res = False
						break
				else:
					temp = abs(x - xn) + abs(y - yn) + hn
					if ans != 0 and ans != temp:
						res = False
						break
					else:
						ans = temp
			if max_num >= 2 and ans == 0 or ans > max_num:
				res = False
			if res:
				if ans != 0:
					print(x, y, ans)
				else:
					print(x, y, 1)
				return

def __starting_point():
	main()
__starting_point()


n = int(input())
xyh = [tuple(map(int, input().split())) for i in range(n)]
xyh.sort(key=lambda tup: -tup[2])
for x in range(101):
	for y in range(101):
		esth = abs(x - xyh[0][0]) + abs(y - xyh[0][1]) + xyh[0][2]
		for i in range(1, n):
			if xyh[i][2] == 0:
				if esth > abs(x - xyh[i][0]) + abs(y - xyh[i][1]):
					break
			elif esth != abs(x - xyh[i][0]) + abs(y - xyh[i][1]) + xyh[i][2]:
				break
		else:
			print(x, y, esth)
			exit()
		continue


import sys
from io import StringIO
import unittest

class TestClass(unittest.TestCase):

	def assertIO(self, input, output):
		(stdout, stdin) = (sys.stdout, sys.stdin)
		(sys.stdout, sys.stdin) = (StringIO(), StringIO(input))
		resolve()
		sys.stdout.seek(0)
		out = sys.stdout.read()[:-1]
		(sys.stdout, sys.stdin) = (stdout, stdin)
		self.assertEqual(out, output)

	def test_入力例_1(self):
		input = '4\n2 3 5\n2 1 5\n1 2 5\n3 2 5'
		output = '2 2 6'
		self.assertIO(input, output)

	def test_入力例_2(self):
		input = '2\n0 0 100\n1 1 98'
		output = '0 0 100'
		self.assertIO(input, output)

	def test_入力例_3(self):
		input = '3\n99 1 191\n100 1 192\n99 0 192'
		output = '100 0 193'
		self.assertIO(input, output)

	def test_入力例_4(self):
		input = '4\n59 3 0\n64 94 56\n5 62 11\n3 93 14'
		output = '55 80 79'
		self.assertIO(input, output)

def resolve():
	N = int(input())
	XYH = [list(map(int, input().split())) for _ in range(N)]
	XYH.sort(key=lambda x: x[2], reverse=True)
	CX = CY = H = 0
	flag = False
	for cx in range(101):
		if flag == True:
			break
		for cy in range(101):
			H = XYH[0][2] + abs(XYH[0][0] - cx) + abs(XYH[0][1] - cy)
			for xyh in XYH[1:]:
				(x, y, h) = xyh
				if h != max(H - abs(x - cx) - abs(y - cy), 0):
					break
			else:
				flag = True
				CX = cx
				CY = cy
				break
	print(f'{CX} {CY} {H}')

def __starting_point():
	resolve()
__starting_point()


N = int(input())
data = sorted([list(map(int, input().split())) for _ in range(N)], key=lambda x: x[2])
(lx, ly, lh) = data[-1]
for cy in range(101):
	for cx in range(101):
		H = lh + abs(cx - lx) + abs(cy - ly)
		if all((h == max(H - abs(cx - x) - abs(cy - y), 0) for (x, y, h) in data)):
			print(cx, cy, H)
			exit()


import math
from math import gcd, pi, sqrt
INF = float('inf')
import sys
sys.setrecursionlimit(10 ** 6)
import itertools
from collections import Counter, deque

def i_input():
	return int(input())

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

def i_list():
	return list(i_map())

def i_row(N):
	return [i_input() for _ in range(N)]

def i_row_list(N):
	return [i_list() for _ in range(N)]

def s_input():
	return input()

def s_map():
	return input().split()

def s_list():
	return list(s_map())

def s_row(N):
	return [s_input for _ in range(N)]

def s_row_str(N):
	return [s_list() for _ in range(N)]

def s_row_list(N):
	return [list(s_input()) for _ in range(N)]

def main():
	n = i_input()
	l = [i_list() for i in range(n)]
	L = []
	for i in l:
		if i[2] != 0:
			L.append(i)
	if len(L) == 1:
		print(' '.join(map(str, L[0])))
		return
	for x in range(101):
		for y in range(101):
			H = L[0][2] + abs(x - L[0][0]) + abs(y - L[0][1])
			flg = True
			for (x1, y1, h1) in L[1:]:
				if h1 == 0:
					pass
				if H != h1 + abs(x - x1) + abs(y - y1):
					flg = False
					break
			if flg == True:
				ans = [x, y]
	H = L[0][2] + abs(ans[0] - L[0][0]) + abs(ans[1] - L[0][1])
	print(' '.join(map(str, ans)) + ' ' + str(H))

def __starting_point():
	main()
__starting_point()


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 i in range(101):
	for j in range(101):
		center = [i, j, ah + abs(ax - i) + abs(ay - j)]
		if all((t[2] == max(center[2] - abs(t[0] - center[0]) - abs(t[1] - center[1]), 0) for t in p)):
			print(center[0], center[1], center[2])


r = range(int(input()))
p = [[int(i) for i in input().split()] for _ in r]
p.sort(key=lambda x: x[2])
(a, b, c) = p[-1]
for x in range(101):
	for y in range(101):
		h = c + abs(a - x) + abs(b - y)
		if all((k == max(h - abs(i - x) - abs(j - y), 0) for (i, j, k) in p)):
			print(x, y, h)
			exit()


N = int(input())
xyh = [tuple(map(int, input().split())) for _ in range(N)]
xyh.sort(key=lambda a: -a[2])
for cx in range(101):
	for cy in range(101):
		(x, y, h) = xyh[0]
		H = h + abs(cx - x) + abs(cy - y)
		for i in range(1, N):
			(x, y, h) = xyh[i]
			if max(H - abs(cx - x) - abs(cy - y), 0) != h:
				break
		else:
			print(cx, cy, H)
			exit()


n = int(input())
xs = []
ys = []
hs = []
for i in range(n):
	(x, y, h) = map(int, input().split())
	xs.append(x)
	ys.append(y)
	hs.append(h)
for x in range(101):
	for y in range(101):
		for i in range(n):
			if hs[i] > 0:
				H = hs[i] + abs(xs[i] - x) + abs(ys[i] - y)
		for i in range(n):
			if hs[i] != max(0, H - abs(xs[i] - x) - abs(ys[i] - y)):
				break
		else:
			print(x, y, H)
			exit()


n = int(input())
if n == 1:
	(x, y, h) = map(int, input().split())
	print(x, y, h)
	return
s = [list(map(int, input().split())) for _ in range(n)]
for i in range(101):
	for j in range(101):
		h = -1
		ok = 1
		for t in s:
			if t[2] == 0:
				ok += 1
			elif h == -1:
				h = abs(t[0] - i) + abs(t[1] - j) + t[2]
			else:
				h0 = abs(t[0] - i) + abs(t[1] - j) + t[2]
				if h == h0:
					ok += 1
		if ok == n:
			for t in s:
				if abs(t[0] - i) + abs(t[1] - j) <= h:
					if not h == abs(t[0] - i) + abs(t[1] - j) + t[2]:
						ok = 0
				elif not t[2] == 0:
					ok = 0
			if ok == n:
				print(i, j, h)
				return


n = int(input())
li = [list(map(int, input().split())) for i in range(n)]
li.sort(key=lambda x: x[2])
(a, b, c) = li[-1]
for x in range(101):
	for y in range(101):
		h = abs(x - a) + abs(y - b) + c
		if all((k == max(h - abs(x - i) - abs(y - j), 0) for (i, j, k) in li)):
			print(x, y, h)
			exit()


n = int(input())
l = []
l1 = []
for i in range(n):
	l1 = list(map(int, input().split()))
	l1 = l1[::-1]
	l.append(l1)
l = sorted(l)
for i in range(101):
	for j in range(101):
		b = True
		h = abs(i - l[-1][2]) + abs(j - l[-1][1]) + l[-1][0]
		for k in range(n - 1):
			if max(h - abs(i - l[-2 - k][2]) - abs(j - l[-2 - k][1]), 0) != l[-2 - k][0]:
				b = False
		if b:
			print(i, j, h)
			break


n = int(input())
l = []
for i in range(n):
	xyh = list(map(int, input().split()))
	l.append(xyh)
	if xyh[2]:
		(x, y, h) = xyh
for i in range(101):
	for j in range(101):
		k = h + abs(i - x) + abs(j - y)
		if all((h == max(k - abs(i - x) - abs(j - y), 0) for (x, y, h) in l)):
			print(i, j, k)


N = int(input())
p = [0] * N
for i in range(N):
	p[i] = list(map(int, input().split()))
for i in range(N):
	if p[i][2] > 0:
		pp = p[i]
f = 0
for i in range(101):
	for j in range(101):
		H = pp[2] + abs(i - pp[0]) + abs(j - pp[1])
		for k in range(N):
			if p[k][2] != max(H - abs(i - p[k][0]) - abs(j - p[k][1]), 0):
				break
			if k == N - 1:
				xa = i
				ya = j
				Ha = H
				f = 1
				break
		if f == 1:
			break
	if f == 1:
		break
print(xa, ya, Ha)


import sys
n = int(input())
xyh = [list(map(int, input().split())) for i in range(n)]
cnt = 0
for i in range(n):
	if xyh[i][2] != 0:
		cnt += 1
if cnt == 1:
	for i in range(n):
		if xyh[i][2] != 0:
			print(' '.join(list(map(str, xyh[i]))))
			return
for i in range(101):
	for j in range(101):
		x = []
		for k in range(n):
			if xyh[k][2] != 0:
				x.append(abs(xyh[k][0] - i) + abs(xyh[k][1] - j) + xyh[k][2])
		if len(set(x)) == 1:
			print(i, j, x[0])


n = int(input())
xl = []
yl = []
hl = []
for i in range(n):
	(xx, yy, hh) = list(map(int, input().split()))
	xl.append(xx)
	yl.append(yy)
	hl.append(hh)
for cx in range(0, 101):
	for cy in range(0, 101):
		ok = True
		for i in range(n):
			x = xl[i]
			y = yl[i]
			h = hl[i]
			if h != 0:
				high = h + abs(x - cx) + abs(y - cy)
				break
		for i in range(n):
			x = xl[i]
			y = yl[i]
			h = hl[i]
			oh = max(high - abs(x - cx) - abs(y - cy), 0)
			if h != oh:
				ok = False
				break
		if ok:
			print(cx, cy, high)
			return


n = int(input())
x = [-1] * n
y = [-1] * n
h = [-1] * n
for i in range(n):
	(x[i], y[i], h[i]) = map(int, input().split())
mh = max(h)
for cx in range(0, 101):
	for cy in range(0, 101):
		for H in range(mh, mh + 216):
			if all((h[j] == max(H - abs(cx - x[j]) - abs(cy - y[j]), 0) for j in range(n))):
				print(cx, cy, H)
				exit()


N = int(input())
xyh = []
for i in range(N):
	(x, y, h) = map(int, input().split())
	xyh.append([x, y, h])
xyh.sort(reverse=True, key=lambda x: x[2])
for i in range(101):
	for j in range(101):
		(px, py, ph) = xyh[0]
		H = ph + abs(px - i) + abs(py - j)
		if all((h == max(H - abs(x - i) - abs(y - j), 0) for (x, y, h) in xyh)):
			print(i, j, H)
			break


n = int(input())
xyh = []
for i in range(n):
	xyh.append(list(map(int, input().split())))
xyh.sort(key=lambda x: x[2], reverse=True)
for i in range(101):
	for j in range(101):
		h = xyh[0][2] + abs(xyh[0][0] - i) + abs(xyh[0][1] - j)
		flag = True
		for k in range(1, n):
			if xyh[k][2] == 0:
				if abs(xyh[k][0] - i) + abs(xyh[k][1] - j) < h:
					flag = False
					break
			else:
				temp = xyh[k][2] + abs(xyh[k][0] - i) + abs(xyh[k][1] - j)
				if h != temp:
					flag = False
					break
		if flag == True and h >= 1:
			print(i, j, h)
			break
	if flag == True:
		break


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


def getH(x, cx, y, cy, h):
	return h + abs(x - cx) + abs(y - cy)
N = int(input())
conditions = []
for i in range(N):
	(x, y, h) = map(int, input().split())
	if h > 0:
		conditions.append([x, y, h])
num_cnd = len(conditions)
if num_cnd == 1:
	print(conditions[0][0], conditions[0][1], conditions[0][2])
	return
for cx in range(101):
	for cy in range(101):
		cnt = 0
		h = 0
		for (i, cnd) in enumerate(conditions):
			h_tmp = getH(cnd[0], cx, cnd[1], cy, cnd[2])
			if h_tmp >= 1:
				if i == 0:
					h = h_tmp
					cnt += 1
				elif h == h_tmp:
					cnt += 1
					if cnt == num_cnd:
						print(cx, cy, h)
						return
				else:
					break
			else:
				break
print('No')


A = abs
(_, *p) = [list(map(int, t.split())) for t in open(0)]
for t in p:
	if t[2]:
		(x, y, h) = t
r = range(101)
for i in r:
	for j in r:
		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)))


n = int(input())
xyh = [tuple(map(int, input().split())) for i in range(n)]
for (xi, yi, hi) in xyh:
	if hi:
		(xt, yt, ht) = (xi, yi, hi)
for i in range(101):
	for j in range(101):
		a = ht + abs(i - xt) + abs(j - yt)
		for (xi, yi, hi) in xyh:
			x = max(a - abs(xi - i) - abs(yi - j), 0)
			if hi != x:
				break
		else:
			print(i, j, a)
			exit(0)


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()


N = int(input())
l = [list(map(int, input().split())) for _ in range(N)]
for (x, y, h) in l:
	if h == 0:
		continue
	for Cx in range(0, 101):
		for Cy in range(0, 101):
			H = abs(Cx - x) + abs(Cy - y) + h
			if all((hh == max(H - abs(Cx - xx) - abs(Cy - yy), 0) for (xx, yy, hh) in l)):
				print(Cx, Cy, H)
				exit()


n = int(input())
points = []
for i in range(n):
	(x, y, h) = map(int, input().split())
	points.append((h, x, y))
points.sort(reverse=True)
for i in range(101):
	for j in range(101):
		(ph, px, py) = points[0]
		H = ph + abs(px - i) + abs(py - j)
		if all((ph == max(H - abs(px - i) - abs(py - j), 0) for (ph, px, py) in points)):
			print(i, j, H)


n = int(input())
A = [[int(i) for i in input().split()] for i in range(n)]
A.sort(reverse=True, key=lambda x: x[2])
for i in range(101):
	for j in range(101):
		(px, py, ph) = A[0]
		H = ph + abs(px - i) + abs(py - j)
		if all((h == max(H - abs(x - i) - abs(y - j), 0) for (x, y, h) in A)):
			print(i, j, H)


N = int(input())
l = [list(map(int, input().split())) for i in range(N)]
for (i, j, k) in l:
	if k > 0:
		(fx, fy, fh) = (i, j, k)
for i in range(0, 101):
	for j in range(0, 101):
		sw = 0
		cer_h = fh + abs(fx - i) + abs(fy - j)
		for (x, y, h) in l:
			if max(cer_h - abs(i - x) - abs(j - y), 0) != h:
				sw = 1
				break
		if sw == 0:
			print(i, j, cer_h)
			exit()


import sys
n = int(input())
(x, y, h) = ([], [], [])
for i in range(n):
	(xi, yi, hi) = map(int, input().split())
	x.append(xi)
	y.append(yi)
	h.append(hi)
	if hi > 0:
		num = i
for cx in range(0, 101):
	for cy in range(0, 101):
		H = h[num] + abs(x[num] - cx) + abs(y[num] - cy)
		if all([max(H - abs(xi - cx) - abs(yi - cy), 0) == hi for (xi, yi, hi) in zip(x, y, h)]):
			print(cx, cy, H)
			sys.exit()


import sys
MOD = 10 ** 9 + 7
INF = 10 ** 9
PI = 3.141592653589793

def read_str():
	return sys.stdin.readline().strip()

def read_int():
	return int(sys.stdin.readline().strip())

def read_ints():
	return map(int, sys.stdin.readline().strip().split())

def read_ints2(x):
	return map(lambda num: int(num) - x, sys.stdin.readline().strip().split())

def read_str_list():
	return list(sys.stdin.readline().strip().split())

def read_int_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def GCD(a: int, b: int) -> int:
	return b if a % b == 0 else GCD(b, a % b)

def LCM(a: int, b: int) -> int:
	return a * b // GCD(a, b)

def solve(info):
	for Cx in range(101):
		for Cy in range(101):
			height = abs(Cx - info[0][0]) + abs(Cy - info[0][1]) + info[0][2]
			flag = True
			for (x, y, h) in info[1:]:
				val = max(height - abs(Cx - x) - abs(Cy - y), 0)
				if h == val:
					continue
				else:
					flag = False
					break
			if flag:
				return (Cx, Cy, height)

def Main():
	n = read_int()
	info = [tuple(read_ints()) for _ in range(n)]
	info.sort(key=lambda x: x[2], reverse=True)
	print(*solve(info))

def __starting_point():
	Main()
__starting_point()


N = int(input())
info = [list(map(int, input().split())) for _ in range(N)]
info.sort(key=lambda x: x[2])
(x, y, h) = info[-1]
for cx in range(101):
	for cy in range(101):
		H = h + abs(x - cx) + abs(y - cy)
		if all((h_ == max(H - abs(x_ - cx) - abs(y_ - cy), 0) for (x_, y_, h_) in info)):
			print(cx, cy, H)
			exit()


n = int(input())
data = [tuple(map(int, input().split())) for _ in range(n)]
(ax, ay, ah) = list(filter(lambda x: x[2], data))[0]
for cx in range(101):
	for cy in range(101):
		H = ah + abs(ax - cx) + abs(ay - cy)
		if all((max(H - abs(d[0] - cx) - abs(d[1] - cy), 0) == d[2] for d in data)):
			print(cx, cy, H)
			exit()


N = int(input())
A = [list(map(int, input().split())) for i in range(N)]
B = sorted(A, key=lambda x: x[2])
for i in range(101):
	for j in range(101):
		H = abs(B[-1][0] - i) + abs(B[-1][1] - j) + B[-1][2]
		for k in range(N - 1):
			if max(H - abs(B[k][0] - i) - abs(B[k][1] - j), 0) != B[k][2]:
				break
		else:
			print(i, j, H)
			exit()


N = int(input())
XYH = [list(map(int, input().split())) for _ in range(N)]
for cx in range(101):
	for cy in range(101):
		ch = None
		for (x, y, h) in XYH:
			if 0 < h:
				ch = h + abs(x - cx) + abs(y - cy)
				if 0 < ch:
					break
		else:
			continue
		for (x, y, h) in XYH:
			th = max(0, ch - abs(x - cx) - abs(y - cy))
			if th != h:
				break
		else:
			print(cx, cy, ch)
			exit()


N = int(input())
P = [list(map(int, input().split())) for i in range(N)]
P.sort(key=lambda x: x[2])
(a, b, c) = P[-1]
for px in range(101):
	for py in range(101):
		H = abs(px - a) + abs(py - b) + c
		if all((h == max(H - abs(x - px) - abs(y - py), 0) for (x, y, h) in P)):
			print(px, py, H)
			break


from sys import stdin
(N, *xyh) = map(int, stdin.read().split())
xyh = list(zip(*[iter(xyh)] * 3))
xyh.sort(key=lambda x: -x[2])
(x1, y1, h1) = xyh[0]
for X in range(101):
	for Y in range(101):
		H = h1 + abs(x1 - X) + abs(y1 - Y)
		if all((max(H - abs(x - X) - abs(y - Y), 0) == h for (x, y, h) in xyh[1:])):
			print(X, Y, H)
			break


l = []
A = abs
r = range(101)
for _ in range(int(input())):
	(*t,) = map(int, input().split())
	l += [t]
	if t[2]:
		(a, b, c) = t
for i in r:
	for j in r:
		H = c + A(i - a) + A(j - b)
		if all((h == max(0, H - A(i - x) - A(j - y)) for (x, y, h) in l)):
			print(i, j, H)


n = int(input())
info = [list(map(int, input().split())) for _ in range(n)]
for i in info:
	if i[2] > 0:
		(x, y, h) = (i[0], i[1], i[2])
		break
for i in range(101):
	for j in range(101):
		H = h + abs(x - i) + abs(y - j)
		if all((max(H - abs(k[0] - i) - abs(k[1] - j), 0) == k[2] for k in info)):
			print(i, j, H)


import math
import io
data = int(input())
array = [list(map(int, input().split())) for _ in range(data)]
(n, m, k) = list(filter(lambda n: n[2], array))[0]
for i in range(101):
	for j in range(101):
		kite = k + abs(n - i) + abs(m - j)
		if all((max(kite - abs(t[0] - i) - abs(t[1] - j), 0) == t[2] for t in array)):
			print(i, j, kite)


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)))


n = int(input())
list1 = [list(map(int, input().split())) for i in range(n)]
for i in list1:
	if i[2] != 0:
		(a, b, c) = i
		break
for y in range(101):
	for x in range(101):
		h = c + abs(a - x) + abs(b - y)
		if all((h_ == max(h - abs(x - i) - abs(y - j), 0) for (i, j, h_) in list1)):
			print(x, y, h)
			exit()


N = int(input())
XYH = [list(map(int, input().split())) for i in range(N)]
XYH.sort(key=lambda x: x[2], reverse=1)
for Cx in range(101):
	for Cy in range(101):
		H = XYH[0][2] + abs(XYH[0][0] - Cx) + abs(XYH[0][1] - Cy)
		cnt = 0
		for (X, Y, h) in XYH:
			if h == max(H - abs(X - Cx) - abs(Y - Cy), 0):
				cnt += 1
		if cnt == N:
			print(Cx, Cy, H)
			break


n = int(input())
x = [0] * n
y = [0] * n
h = [0] * n
for i in range(n):
	(x[i], y[i], h[i]) = map(int, input().split())
for cx in range(101):
	for cy in range(101):
		H = -1
		for i in range(n):
			if h[i] == 0:
				pass
			else:
				tmp = h[i] + abs(x[i] - cx) + abs(y[i] - cy)
				H = tmp
				break
		flag = True
		for i in range(n):
			if h[i] != max(H - abs(x[i] - cx) - abs(y[i] - cy), 0):
				flag = False
				break
		if flag:
			print(cx, cy, H)


n = int(input())
hxy = []
for i in range(n):
	(x, y, h) = map(int, input().split())
	hxy.append([h, x, y])
hxy.sort(reverse=True)
for i in range(101):
	for j in range(101):
		(h, x, y) = hxy[0]
		H = h + abs(x - i) + abs(y - j)
		if all((h == max(H - abs(x - i) - abs(y - j), 0) for (h, x, y) in hxy)):
			print(i, j, H)


n = int(input())
x_list = []
y_list = []
h_list = []
for i in range(n):
	(a, b, c) = list(map(int, input().split()))
	x_list.append(a)
	y_list.append(b)
	h_list.append(c)
k = h_list.index(max(h_list))
for x in range(101):
	for y in range(101):
		h_max = h_list[k] + abs(x_list[k] - x) + abs(y_list[k] - y)
		for j in range(n):
			if h_list[j] == 0:
				if h_max - (abs(x_list[j] - x) + abs(y_list[j] - y)) > 0:
					h_max = -1
			elif h_max != abs(x_list[j] - x) + abs(y_list[j] - y) + h_list[j]:
				h_max = -1
		if h_max != -1:
			print(str(x) + ' ' + str(y) + ' ' + str(h_max))
			break


import sys
input = sys.stdin.readline
N = int(input())
xyh = [0] * N
h_list = [0] * N
for i in range(N):
	(x, y, h) = (int(i) for i in input().split())
	xyh[i] = (x, y, h)
	h_list[i] = h
from bisect import bisect_right
xyh.sort(key=lambda x: x[2])
h_list.sort()
ind = bisect_right(h_list, 0)
from collections import defaultdict
H = defaultdict(set)
for (x, y, h) in xyh[ind:]:
	for cx in range(101):
		for cy in range(101):
			xx = x - cx
			yy = y - cy
			if cx <= x and cy <= y:
				H[cx, cy].add(h + xx + yy)
			elif cx > x and cy <= y:
				H[cx, cy].add(h - xx + yy)
			elif cx <= x and cy > y:
				H[cx, cy].add(h + xx - yy)
			elif cx > x and cy > y:
				H[cx, cy].add(h - xx - yy)
if len(xyh[ind:]) == 1:
	print(*xyh[-1])
else:
	for (k, v) in H.items():
		if len(v) == 1:
			vv = v.pop()
			if 0 <= vv:
				print(*k, vv)
			elif vv < 0:
				print(*k, 0)


N = int(input())
z = []
for i in range(N):
	z.append(list(map(int, input().split())))
h = max((zz[2] for zz in z))
while 1:
	flag = 1
	for x in range(101):
		for y in range(101):
			for zz in z:
				if max(h - abs(zz[0] - x) - abs(zz[1] - y), 0) != zz[2]:
					break
			else:
				print(x, y, h)
				exit()
	h += 1


n = int(input())
d = [list(map(int, input().split())) for i in range(n)]
for x in range(101):
	for y in range(101):
		for i in d:
			if i[2] > 0:
				H = i[2] + abs(x - i[0]) + abs(y - i[1])
				break
		if all((l[2] == max(H - abs(x - l[0]) - abs(y - l[1]), 0) for l in d)):
			print('{} {} {}'.format(x, y, H))
			exit()


n = int(input())
P = []
for _ in range(n):
	(x, y, h) = map(int, input().split())
	P.append([h, x, y])
P.sort(reverse=True)
for cx in range(101):
	for cy in range(101):
		H = P[0][0] + abs(P[0][1] - cx) + abs(P[0][2] - cy)
		for i in range(1, n):
			if max(H - abs(P[i][1] - cx) - abs(P[i][2] - cy), 0) != P[i][0]:
				break
		else:
			print(cx, cy, H)
			return


N = int(input())
x = [list(map(int, input().split())) for _ in range(N)]
x.sort(key=lambda x: -x[2])
dp = [[0] * 101 for i in range(101)]
bp = [[0] * 101 for i in range(101)]
for j in range(101):
	for k in range(101):
		(a, b, c) = x[0]
		r = 0
		asa = abs(a - j) + abs(b - k) + c
		for i in range(N):
			count = abs(x[i][0] - j) + abs(x[i][1] - k)
			if x[i][2] == max(asa - count, 0):
				r += 1
		if r == N:
			print(j, k, asa)
			exit()


n = int(input())
e = [[int(i) for i in input().split()] for i in range(n)]
h = 0
for a in range(n):
	if e[a][2] > 0:
		s = a
		break
for x in range(0, 101):
	for y in range(0, 101):
		k = abs(x - e[s][0]) + abs(y - e[s][1]) + e[s][2]
		for i in range(0, n):
			if e[i][2] != max(k - abs(x - e[i][0]) - abs(y - e[i][1]), 0):
				break
		else:
			print(x, y, k)


(n, *xyh) = map(int, open(0).read().split())
a = sorted([(xyh[i * 3], xyh[i * 3 + 1], xyh[i * 3 + 2]) for i in range(n)], key=lambda x: x[2], reverse=True)
for i in range(101):
	for j in range(101):
		dh = abs(a[0][0] - i) + abs(a[0][1] - j) + a[0][2]
		for (x, y, h) in a[1:]:
			if h != max(dh - abs(x - i) - abs(y - j), 0):
				break
		else:
			print(i, j, dh)
			return


N = int(input())
xyh = []
for i in range(N):
	xyh.append(list(map(int, input().split())))
xyh_sorted = sorted(xyh, key=lambda x: x[2], reverse=True)
answer = [0, 0, 0]
for cy in range(0, 101):
	for cx in range(0, 101):
		H = xyh_sorted[0][2] + abs(xyh_sorted[0][0] - cx) + abs(xyh_sorted[0][1] - cy)
		flag = True
		for i in range(1, N):
			h2 = max(H - abs(xyh_sorted[i][0] - cx) - abs(xyh_sorted[i][1] - cy), 0)
			if h2 != xyh_sorted[i][2]:
				flag = False
				break
		if flag:
			answer = [cx, cy, H]
			break
	if flag:
		break
answerString = str(answer[0]) + ' ' + str(answer[1]) + ' ' + str(answer[2])
print(answerString)


N = int(input())
p = [tuple(map(int, input().split())) for _ in range(N)]
p.sort(key=lambda x: x[2])
(mx, my, mh) = p[-1]
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 p)):
			print(cx, cy, H)
			break


n = int(input())
x = [0] * n
y = [0] * n
h = [0] * n
for i in range(n):
	(x[i], y[i], h[i]) = map(int, input().split())
H = max(h)
while 1:
	for i in range(101):
		for j in range(101):
			flg = True
			for k in range(n):
				(dx, dy) = (abs(x[k] - i), abs(y[k] - j))
				if max(H - dx - dy, 0) != h[k]:
					flg = False
			if flg:
				print(i, j, H)
				exit()
	H += 1


n = int(input())
XYH = [list(map(int, input().split())) for _ in range(n)]
A = []
(cnt, add) = (0, [0, 0])
for i in range(101):
	for j in range(101):
		for (x, y, h) in XYH:
			H = h + abs(x - i) + abs(y - j)
			A.append([H, i, j])
for (H, cx, cy) in A:
	flag = 1
	for (x, y, h) in XYH:
		if max(H - abs(x - cx) - abs(y - cy), 0) != h:
			flag = 0
		if not flag:
			break
	if flag:
		print(cx, cy, H)
		exit()


n = int(input())
_h = 0
li = []
for _ in range(n):
	(x, y, h) = map(int, input().split())
	li.append((x, y, h))
	if not _h:
		(_x, _y, _h) = (x, y, h)
for i in range(101):
	for j in range(101):
		H = _h + abs(i - _x) + abs(j - _y)
		if all((h == max(0, H - abs(i - x) - abs(j - y)) for (x, y, h) in li)):
			print(i, j, H)
			exit()
		else:
			pass


N = int(input())
xyh = [[int(i) for i in input().split()] for _ in range(N)]
xyh.sort(key=lambda x: x[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()


n = int(input())
xyh = []
for i in range(n):
	(x, y, h) = map(int, input().split())
	xyh.append([h, x, y])
xyh.sort(reverse=True)
ans = 0
for cx in range(101):
	for cy in range(101):
		for N in range(n):
			if abs(xyh[0][1] - cx) + abs(xyh[0][2] - cy) + xyh[0][0] > 0:
				H = abs(xyh[0][1] - cx) + abs(xyh[0][2] - cy) + xyh[0][0]
			else:
				break
			if xyh[N][0] != max(H - abs(xyh[N][1] - cx) - abs(xyh[N][2] - cy), 0):
				break
			if N == n - 1:
				ans = [cx, cy, H]
print(*ans)


N = int(input())
X = []
Y = []
H = []
for i in range(N):
	(x, y, h) = map(int, input().split())
	X.append(x)
	Y.append(y)
	H.append(h)
	if h > 0:
		(x_, y_, h_) = (x, y, h)
for px in range(101):
	for py in range(101):
		H_ = h_ + abs(px - x_) + abs(py - y_)
		for i in range(N):
			if H[i] != max(H_ - abs(px - X[i]) - abs(py - Y[i]), 0):
				break
		else:
			print(px, py, H_)
			exit()


n = int(input())
f = [list(map(int, input().split())) for _ in range(n)]

def k(H, cx, cy, f):
	for (x, y, h) in f:
		if h == max(H - abs(x - cx) - abs(y - cy), 0):
			continue
		else:
			return
	print(cx, cy, H)
	exit()
for (x, y, h) in f:
	if h == 0:
		continue
	for cx in range(101):
		for cy in range(101):
			H = h + abs(x - cx) + abs(y - cy)
			k(H, cx, cy, f)


def dist(a, b, x, y, h):
	return h + abs(a - x) + abs(b - y)
N = int(input())
P = []
for i in range(N):
	(x, y, h) = map(int, input().split())
	P.append([h, x, y])
P.sort(reverse=True)
for i in range(101):
	for j in range(101):
		H = dist(i, j, P[0][1], P[0][2], P[0][0])
		for p in P[1:]:
			if max(H - abs(p[1] - i) - abs(p[2] - j), 0) != p[0]:
				break
		else:
			print(i, j, H)
			break


n = int(input())
x = []
y = []
h = []
for i in range(n):
	(a, b, c) = map(int, input().split())
	x.append(a)
	y.append(b)
	h.append(c)
	if c != 0:
		q = [a, b, c]
for i in range(101):
	for j in range(101):
		H = q[2] + abs(q[0] - i) + abs(q[1] - j)
		for (a, b, c) in zip(x, y, h):
			if c != max(H - abs(a - i) - abs(b - j), 0):
				break
		else:
			print(i, j, H)
			exit()


N = int(input())
k = 0
data = list()
for i in range(N):
	l = list(map(int, input().split()))
	data.append(l)
	if l[2] > 0:
		k = i
for x in range(101):
	for y in range(101):
		H = data[k][2] + abs(x - data[k][0]) + abs(y - data[k][1])
		if all([max(H - abs(x - l[0]) - abs(y - l[1]), 0) == l[2] for l in data]):
			print(x, y, H)


def p_c():
	from itertools import product
	N = int(input())
	xyh = [tuple(map(int, input().split())) for _ in range(N)]
	h = 0
	for i in xyh:
		if h < i[2]:
			(x_, y_, h) = i
	for (x, y) in product(range(101), repeat=2):
		high = h + abs(x_ - x) + abs(y_ - y)
		if all((h == max(0, high - abs(x - i) - abs(y - j)) for (i, j, h) in xyh)):
			print(x, y, high)
p_c()


N = int(input())
P = [list(map(int, input().split())) for k in range(N)]
for h in range(P[0][2], P[0][2] + 201):
	for x in range(101):
		for y in range(101):
			f = 1
			for e in P:
				if e[2] != max(0, h - abs(e[0] - x) - abs(e[1] - y)):
					f = 0
					break
			if f == 1:
				print(x, y, h)
				exit(0)


N = int(input())
(xs, ys, hs) = ([], [], [])
for _ in range(N):
	(x, y, h) = map(int, input().split())
	if h != 0:
		(xx, yy, hh) = (x, y, h)
	xs.append(x)
	ys.append(y)
	hs.append(h)
for cx in range(101):
	for cy in range(101):
		H = hh + abs(xx - cx) + abs(yy - cy)
		if all([hs[i] == max(0, H - abs(cx - xs[i]) - abs(cy - ys[i])) for i in range(N)]):
			print(cx, cy, H)
			return


n = int(input())
xyh = [list(map(int, input().split())) for _ in range(n)]
test = [(x, y, h) for (x, y, h) in xyh if h > 0]
test = test[0]
for cx in range(101):
	for cy in range(101):
		(x, y, h) = test
		H = h + abs(x - cx) + abs(y - cy)
		if all([max(H - abs(x - cx) - abs(y - cy), 0) == h for (x, y, h) in xyh]):
			print(cx, cy, H)
			return


N = int(input())
info = [list(map(int, input().split())) for _ in range(N)]

def judge(Cx, Cy):
	for (x, y, h) in info:
		if h != 0:
			H = abs(x - Cx) + abs(y - Cy) + h
			break
	for (x, y, h) in info:
		if max(H - abs(x - Cx) - abs(y - Cy), 0) != h:
			return
	global ans
	ans = [Cx, Cy, H]
for Cx in range(101):
	for Cy in range(101):
		judge(Cx, Cy)
print(*ans)


n = int(input())
XYH = [list(map(int, input().split())) for _ in range(n)]
XYH.sort(key=lambda x: x[2])
(X, Y, H) = XYH[-1]
for cx in range(101):
	for cy in range(101):
		h = H + abs(cx - X) + abs(cy - Y)
		flag = False
		for xyh in XYH:
			if xyh[2] != max(h - abs(cx - xyh[0]) - abs(cy - xyh[1]), 0):
				flag = True
		if flag:
			continue
		print(cx, cy, h)
		exit()


n = int(input())
xyh = [list(map(int, input().split())) for i in range(n)]
xyh.sort(key=lambda x: x[2], reverse=True)
for X in range(0, 101):
	for Y in range(0, 101):
		H = xyh[0][2] + abs(xyh[0][0] - X) + abs(xyh[0][1] - Y)
		for i in range(1, n):
			(x, y, h) = xyh[i]
			if h != max(H - abs(x - X) - abs(y - Y), 0):
				break
		else:
			print(X, Y, H)
			break


from itertools import product
N = int(input())
L = tuple((tuple(map(int, input().split())) for _ in range(N)))
for (xc, yc) in product(range(101), repeat=2):
	s = set((abs(xc - x) + abs(yc - y) + h for (x, y, h) in L if h != 0))
	if len(s) == 1:
		H = next(iter(s))
		if all((abs(xc - x) + abs(yc - y) >= H for (x, y, h) in L if h == 0)):
			print(xc, yc, H)
			break


N = int(input())
l = [list(map(int, input().split())) for i in range(N)]
l.sort(key=lambda x: x[2], reverse=True)
for i in range(101):
	for j in range(101):
		h = l[0][2] + abs(i - l[0][0]) + abs(j - l[0][1])
		for k in range(N):
			tmp = max(h - abs(i - l[k][0]) - abs(j - l[k][1]), 0)
			if tmp != l[k][2]:
				break
			elif k == N - 1:
				X = i
				Y = j
				H = h
print(X, Y, H)


n = int(input())
info = [list(map(int, input().split())) for i in range(n)]
for cx in range(0, 101):
	for cy in range(0, 101):
		H = -10 ** 20
		lim = 10 ** 20
		for l in info:
			(x, y, h) = l
			if h == 0:
				lim = min(lim, abs(x - cx) + abs(y - cy))
			else:
				if H != -10 ** 20 and H != abs(x - cx) + abs(y - cy) + h:
					break
				H = abs(x - cx) + abs(y - cy) + h
			if H > lim:
				break
		else:
			print(cx, cy, H)
			return


N = int(input())
list = [list(map(int, input().split())) for i in range(N)]
for i in range(N):
	if list[i][2]:
		(x0, y0, h0) = list[i]
for Cx in range(0, 101):
	for Cy in range(0, 101):
		for i in range(N):
			H = max(h0 + abs(x0 - Cx) + abs(y0 - Cy), 0)
			if max(H - abs(list[i][0] - Cx) - abs(list[i][1] - Cy), 0) != list[i][2]:
				break
		else:
			print(Cx, Cy, H)


n = int(input())
l = []
for i in range(n):
	(x, y, h) = map(int, input().split())
	l.append([x, y, h])
	if h != 0:
		(a, b, c) = (x, y, h)
for x in range(101):
	for y in range(101):
		h = c + abs(x - a) + abs(y - b)
		if all((r == max(h - abs(x - s) - abs(y - t), 0) for (s, t, r) in l)):
			print(x, y, h)
			exit()


ll = [list(map(int, input().split())) for _ in range(int(input()))]
(x, y, h) = list(filter(lambda k: k[2], ll))[0]
for cx in range(101):
	for cy in range(101):
		ch = h + abs(x - cx) + abs(y - cy)
		if all((max(ch - abs(x - cx) - abs(y - cy), 0) == h for (x, y, h) in ll)):
			print(cx, cy, ch)
			exit()


n = int(input())
l = [list(map(int, input().split())) for _ in range(n)]
a = []
for x in range(101):
	for y in range(101):
		c = []
		for t in l:
			if t[2]:
				c.append(t[2] + abs(x - t[0]) + abs(y - t[1]))
		f = 0
		if len(set(c)) == 1:
			f = 1
			h = c[0]
			for t in l:
				if t[2] == 0:
					if h - abs(x - t[0]) - abs(y - t[1]) > 0:
						f = 0
		if f:
			print(x, y, h)
			exit()


N = int(input())
lst = [list(map(int, input().split())) for _ in range(N)]
for cx in range(101):
	for cy in range(101):
		for l in lst:
			if l[2] != 0:
				H = abs(cx - l[0]) + abs(cy - l[1]) + l[2]
		for l in lst:
			if l[2] != max(0, H - abs(cx - l[0]) - abs(cy - l[1])):
				break
		else:
			print(cx, cy, H)
			exit(0)


N = int(input())
xyh = [list(map(int, input().split(' '))) for i in range(N)]
for i in range(101):
	for j in range(101):
		H_0 = set([h + abs(x - i) + abs(y - j) for (x, y, h) in xyh])
		H_1 = set([h + abs(x - i) + abs(y - j) for (x, y, h) in xyh if h != 0])
		if len(H_0) == 1:
			print(i, j, max(H_0))
			exit()
		if len(H_1) == 1:
			(cx, cy, H) = (i, j, max(H_1))
print(cx, cy, H)


n = int(input())
x = [list(map(int, input().split())) for _ in range(n)]
for i in range(101):
	for j in range(101):
		for k in range(n):
			if x[k][2] > 0:
				h = x[k][2] + abs(i - x[k][0]) + abs(j - x[k][1])
				break
		chk = 0
		for k in range(n):
			if x[k][2] != max(h - abs(i - x[k][0]) - abs(j - x[k][1]), 0):
				chk = 1
				break
		if chk == 0:
			res = [i, j, h]
			break
	if chk == 0:
		break
print(*res)


n = int(input())
x = [0] * n
y = [0] * n
h = [0] * n
for i in range(n):
	(x[i], y[i], h[i]) = map(int, input().split())
a = 0
i = 0
while h[i] == 0:
	a = a + 1
	i = i + 1
for i in range(101):
	for j in range(101):
		H = abs(i - x[a]) + abs(j - y[a]) + h[a]
		b = 0
		for k in range(n):
			if h[k] != max(H - (abs(i - x[k]) + abs(j - y[k])), 0):
				break
			else:
				b = b + 1
				if b == n:
					print(i, j, H)
		else:
			continue


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()


n = int(input())
l = [list(map(int, input().split())) for i in range(n)]
l.sort(key=lambda x: x[2], reverse=True)
(sx, sy, sh) = l[0]
for xx in range(0, 101):
	for yy in range(0, 101):
		hh = sh + abs(sx - xx) + abs(sy - yy)
		for ll in l[1:]:
			if ll[2] != max(0, hh - abs(ll[0] - xx) - abs(ll[1] - yy)):
				break
		else:
			print(xx, yy, hh)


n = int(input())
XYH = [list(map(int, input().split())) for _ in range(n)]
XYH.sort(key=lambda x: x[2], reverse=True)
(x0, y0, h0) = XYH[0]
for i in range(101):
	for j in range(101):
		H = h0 + abs(i - x0) + abs(j - y0)
		for (x, y, h) in XYH:
			if h > 0:
				if H != h + abs(i - x) + abs(j - y):
					break
			elif H - abs(i - x) - abs(j - y) > 0:
				break
		else:
			print(i, j, H)
			exit()


import sys
N = int(input())
ls = []
for i in range(N):
	(x, y, h) = map(int, input().split())
	ls.append([x, y, h])
ls.sort(key=lambda x: -x[2])
for i in range(0, 101):
	for j in range(0, 101):
		f = True
		H = ls[0][2] + abs(i - ls[0][0]) + abs(j - ls[0][1])
		for k in range(1, N):
			if ls[k][2] != 0:
				H1 = ls[k][2] + abs(i - ls[k][0]) + abs(j - ls[k][1])
				if H1 != H:
					f = False
					break
			elif H > abs(i - ls[k][0]) + abs(j - ls[k][1]):
				f = False
				break
		if f:
			print(i, j, H)
			return


N = int(input())
xyh = [list(map(int, input().split())) for i in range(N)]
x = xyh[0][0]
y = xyh[0][1]
h = xyh[0][2]
xyh.sort(key=lambda k: k[2], reverse=True)
for cx in range(0, 101):
	for cy in range(0, 101):
		H = abs(xyh[0][0] - cx) + abs(xyh[0][1] - cy) + xyh[0][2]
		for (x, y, h) in xyh:
			if h != max(H - abs(x - cx) - abs(y - cy), 0):
				break
		else:
			print(cx, cy, H)
			break


l = [list(map(int, input().split())) for i in range(int(input()))]
l.sort(key=lambda x: x[2])
for i in range(0, 101):
	for j in range(0, 101):
		h = l[-1][2] + abs(i - l[-1][0]) + abs(j - l[-1][1])
		for (a, b, c) in l[:-1]:
			if c != max(0, h - abs(i - a) - abs(j - b)):
				break
		else:
			print(i, j, h)
			exit()


N = int(input())
info = []
for i in range(N):
	info.append(list(map(int, input().split())))
info = list(filter(lambda x: x[2] != 0, info))
xy_00 = max(map(lambda x: x[2] - (x[0] + x[1]), info))
xy_10 = max(map(lambda x: x[2] - (100 - x[0] + x[1]), info))
xy_01 = max(map(lambda x: x[2] - (x[0] + (100 - x[1])), info))
xy_11 = max(map(lambda x: x[2] - (100 - x[0] + (100 - x[1])), info))
cx1 = (-xy_00 + xy_10 + 100) // 2
cx2 = (-xy_01 + xy_11 + 100) // 2
cy1 = (-xy_00 + xy_01 + 100) // 2
cy2 = (-xy_10 + xy_11 + 100) // 2
flag = False
for cx in [cx1, cx2]:
	for cy in [cy1, cy2]:
		ch = info[0][2] + (abs(info[0][0] - cx) + abs(info[0][1] - cy))
		for i in info:
			if not ch == i[2] + abs(cx - i[0]) + abs(cy - i[1]):
				break
		else:
			print(f'{cx} {cy} {ch}')
			flag = True
			break
	if flag == True:
		break


n = int(input())
L = sorted([list(map(int, input().split())) for i in range(n)], key=lambda x: x[2])
for cx in range(101):
	for cy in range(101):
		H = L[-1][2] + abs(L[-1][0] - cx) + abs(L[-1][1] - cy)
		if all([L[i][2] == max(H - abs(L[i][0] - cx) - abs(L[i][1] - cy), 0) for i in range(n - 1)]):
			print(cx, cy, H)


n = int(input())
XYH = [list(map(int, input().split())) for _ in range(n)]
for (x1, y1, h1) in XYH:
	if h1 > 0:
		for Cx in range(101):
			for Cy in range(101):
				H = h1 + abs(x1 - Cx) + abs(y1 - Cy)
				if all((h == max(H - abs(x - Cx) - abs(y - Cy), 0) for (x, y, h) in XYH)):
					print(Cx, Cy, H)
					return


l = []
for _ in range(int(input())):
	t = [*map(int, input().split())]
	l += [t]
	if t[2]:
		(x, y, h) = t
for X in range(101):
	for Y in range(101):
		H = h + abs(x - X) + abs(y - Y)
		if all((h == max(H - abs(x - X) - abs(y - Y), 0) for (x, y, h) in l)):
			print(X, Y, H)


n = int(input())
loc = [list(map(int, input().split())) for _ in range(n)]
loc.sort(key=lambda x: x[2], reverse=True)
for i in range(101):
	for j in range(101):
		h = abs(loc[0][0] - i) + abs(loc[0][1] - j) + loc[0][2]
		for l in loc[1:]:
			if l[2] != max(h - abs(l[0] - i) - abs(l[1] - j), 0):
				break
		else:
			print(i, j, h)
			break


n = int(input())
pos = []
for i in range(n):
	(x, y, h) = map(int, input().split())
	pos.append([x, y, h])
pos = sorted(pos, key=lambda x: x[2])
(tx, ty, th) = pos[-1]

def solve():
	for cx in range(101):
		for cy in range(101):
			H = th + abs(tx - cx) + abs(ty - cy)
			for (x, y, h) in pos:
				if h != max(H - abs(x - cx) - abs(y - cy), 0):
					break
			else:
				return (cx, cy, H)
(cx, cy, H) = solve()
print(cx, cy, H)


N = int(input())
xyh = [list(map(int, input().split())) for _ in range(N)]
xyh = sorted(xyh, key=lambda x: -x[2])
(xt, yt, ht) = xyh[0]
for Cx in range(101):
	for Cy in range(101):
		H = ht + abs(xt - Cx) + abs(yt - Cy)
		if all((h == max(H - abs(x - Cx) - abs(y - Cy), 0) for (x, y, h) in xyh)):
			print(Cx, Cy, H)
			break
	else:
		continue
	break


N = int(input())
l = [list(map(int, input().split())) for i in range(N)]
l.sort(key=lambda x: x[2])
for x in range(101):
	for y in range(101):
		H = abs(x - l[-1][0]) + abs(y - l[-1][1]) + l[N - 1][2]
		if all((l[i][2] == max(H - abs(x - l[i][0]) - abs(y - l[i][1]), 0) for i in range(N))):
			print(x, y, H)
			break
	else:
		continue
	break


n = int(input())
X = [list(map(int, input().split())) for _ in range(n)]
X.sort(key=lambda x: x[2])
(a, b, c) = X[-1]
for px in range(101):
	for py in range(101):
		H = abs(px - a) + abs(py - b) + c
		if all((h == max(H - abs(x - px) - abs(y - py), 0) for (x, y, h) in X)):
			print(px, py, H)
			break


N = int(input())
XYH = [[int(a) for a in input().split(' ')] for i in range(N)]
for cx in range(0, 101):
	for cy in range(0, 101):
		Hp = [abs(x - cx) + abs(y - cy) + h for (x, y, h) in XYH if h > 0]
		Hz = [Hp[0] - abs(x - cx) - abs(y - cy) for (x, y, h) in XYH if h == 0]
		if all([h == Hp[0] for h in Hp]) and all([h <= 0 for h in Hz]):
			print(' '.join([str(cx), str(cy), str(Hp[0])]))


n = int(input())
XYH = list((tuple(map(int, input().split())) for _ in range(n)))
for (x, y, h) in XYH:
	if h != 0:
		(x_, y_, h_) = (x, y, h)
		break
for cx in range(0, 101):
	for cy in range(0, 101):
		H = abs(x_ - cx) + abs(y_ - cy) + h_
		if all([max(H - abs(x - cx) - abs(y - cy), 0) == h for (x, y, h) in XYH]):
			print(cx, cy, H)
			exit()


n = int(input())
xyh = [list(map(int, input().split())) for i in range(n)]
maxh = 0
for (x, y, h) in xyh:
	maxh = max(maxh, h)
for H in range(maxh, maxh + 201):
	for cx in range(101):
		for cy in range(101):
			for (x, y, h) in xyh:
				if h != max(H - abs(x - cx) - abs(y - cy), 0):
					break
			else:
				print(cx, cy, H)
				quit()


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)


n = int(input())
(x, y, h) = ([], [], [])
for i in range(n):
	(a, b, c) = map(int, input().split())
	x.append(a)
	y.append(b)
	h.append(c)
for i in range(n):
	if h[i] != 0:
		s = i
		break
for cx in range(101):
	for cy in range(101):
		H = h[s] + abs(x[s] - cx) + abs(y[s] - cy)
		for i in range(n):
			if h[i] != max(0, H - abs(x[i] - cx) - abs(y[i] - cy)):
				break
			if i == n - 1:
				print(cx, cy, H)
				exit()


import itertools
N = int(input())
XYH = [tuple(map(int, input().split(' '))) for _ in range(N)]
XYH.sort(key=lambda y: y[2], reverse=True)
(x, y, h) = XYH[0]
for (i, j) in itertools.product(range(101), repeat=2):
	H = h + abs(x - i) + abs(y - j)
	if all((max(H - abs(a - i) - abs(b - j), 0) == c for (a, b, c) in XYH)):
		print(i, j, H)
		break


n = int(input())
p = [list(map(int, input().split())) for _ in range(n)]
for cx in range(101):
	for cy in range(101):
		for (xi, yi, hi) in p:
			if hi > 0:
				h = abs(xi - cx) + abs(yi - cy) + hi
				break
		if all((max(h - abs(xi - cx) - abs(yi - cy), 0) == hi for (xi, yi, hi) in p)):
			print(cx, cy, h)
			exit()


from math import ceil, floor, factorial, gcd, sqrt, log2, cos, sin, tan, acos, asin, atan, degrees, radians, pi, inf
from itertools import accumulate, groupby, permutations, combinations, product, combinations_with_replacement
from collections import deque, defaultdict, Counter
from bisect import bisect_left, bisect_right
from operator import itemgetter
from heapq import heapify, heappop, heappush
from queue import Queue, LifoQueue, PriorityQueue
from copy import deepcopy
from time import time
import string
import sys
sys.setrecursionlimit(10 ** 7)

def input():
	return sys.stdin.readline().strip()

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST():
	return list(MAP())
n = INT()
x = [0] * n
y = [0] * n
h = [0] * n
for i in range(n):
	(x[i], y[i], h[i]) = MAP()
for i in range(101):
	for j in range(101):
		H = 0
		for k in range(n):
			if h[k] != 0:
				if H == 0 or H == h[k] + abs(x[k] - i) + abs(y[k] - j):
					H = h[k] + abs(x[k] - i) + abs(y[k] - j)
				else:
					break
		else:
			for k in range(n):
				if h[k] == 0:
					if H - abs(x[k] - i) - abs(y[k] - j) <= 0:
						continue
					else:
						break
			else:
				print(i, j, H)


N = int(input())
lst = [list(map(int, input().split())) for i in range(N)]
for (x, y, h) in lst:
	if h > 0:
		base = (x, y, h)
		break
for cx in range(100 + 1):
	for cy in range(100 + 1):
		H = base[2] + abs(base[0] - cx) + abs(base[1] - cy)
		if all([max(H - abs(x - cx) - abs(y - cy), 0) == h for (x, y, h) in lst]):
			print(cx, cy, H)
			exit()


from operator import itemgetter
n = int(input())
XYH = [tuple(map(int, input().split())) for i in range(n)]
XYH.sort(key=itemgetter(2), reverse=True)
for cy in range(101):
	for cx in range(101):
		hc = XYH[0][2] + abs(cx - XYH[0][0]) + abs(cy - XYH[0][1])
		for (x, y, h) in XYH[1:]:
			if h != max(0, hc - abs(x - cx) - abs(y - cy)):
				break
		else:
			print(cx, cy, hc)


N = int(input())
XYH_list = [list(map(int, input().split())) for i in range(N)]
XYH_list = sorted(XYH_list, key=lambda x: x[2], reverse=True)
for xi in range(0, 101):
	for yi in range(0, 101):
		tmpH = 0
		for k in range(N):
			(x, y, h) = XYH_list[k]
			if k == 0:
				tmpH = h + abs(x - xi) + abs(y - yi)
			if h == max(tmpH - abs(x - xi) - abs(y - yi), 0):
				if k == N - 1:
					ans = [str(xi), str(yi), str(tmpH)]
				continue
			else:
				break
print(' '.join(ans))


n = int(input())
xyh = [list(map(int, input().split())) for _ in range(n)]
xyh.sort(key=lambda x: x[2], reverse=True)
ans = []
for cx in range(101):
	for cy in range(101):
		(x, y, h) = xyh[0]
		ch = h + abs(x - cx) + abs(y - cy)
		if all([h == max(ch - abs(x - cx) - abs(y - cy), 0) for (x, y, h) in xyh[1:]]):
			ans = [cx, cy, ch]
			break
print(*ans, sep=' ')


N = int(input())
X = [list(map(int, input().split())) for _ in range(N)]
X.sort(key=lambda X: -X[2])
count = 0
for i in range(101):
	for j in range(101):
		H = X[0][2] + abs(i - X[0][0]) + abs(j - X[0][1])
		for k in range(N):
			if X[k][2] == max(H - abs(i - X[k][0]) - abs(j - X[k][1]), 0):
				count += 1
		if count == N:
			print(i, j, H)
			break
		count = 0


ll = [list(map(int, input().split())) for _ in range(int(input()))]
ll.sort(key=lambda k: k[2], reverse=1)
(x, y, h) = ll[0]
for cx in range(101):
	for cy in range(101):
		ch = h + abs(x - cx) + abs(y - cy)
		for (x, y, h) in ll:
			if max(ch - abs(x - cx) - abs(y - cy), 0) != h:
				break
		else:
			print(cx, cy, ch)
			break
	else:
		continue
	break


n = int(input())
C = [list(map(int, input().split())) for i in range(n)]
C.sort(key=lambda x: -x[2])
for x in range(101):
	for y in range(101):
		h = C[0][2] + abs(x - C[0][0]) + abs(y - C[0][1])
		if all([c[2] == max(h - abs(x - c[0]) - abs(y - c[1]), 0) for c in C]):
			print(x, y, h)
			exit()


N = int(input())
L = [tuple(map(int, input().split())) for _ in range(N)]
(xx, yy, hh) = next((l for l in L if l[2] >= 1))
for Cx in range(101):
	for Cy in range(101):
		H = hh + abs(xx - Cx) + abs(yy - Cy)
		for (x, y, h) in L:
			if h != max(H - abs(x - Cx) - abs(y - Cy), 0):
				break
		else:
			print(Cx, Cy, H)
			quit()


N = int(input())
X = [list(map(int, input().split())) for _ in range(N)]
C_x = list(range(101))
C_y = list(range(101))
if sum([h for (_, _, h) in X]) == 1:
	for (x, y, h) in X:
		if h != 0:
			print(x, y, h)
else:
	for px in C_x:
		for py in C_y:
			h_list = [abs(x - px) + abs(y - py) + h for (x, y, h) in X if h > 0]
			if len(set(h_list)) == 1:
				print(px, py, h_list[0])
				break


N = int(input())
arr = [list(map(int, input().split())) for _ in range(N)]
arr.sort(key=lambda l: -l[2])
for cx in range(101):
	for cy in range(101):
		ch = None
		for (x, y, h) in arr:
			t = h + abs(cx - x) + abs(cy - y)
			if h > 0:
				if ch is not None and t != ch:
					break
				ch = t
			elif t < ch:
				break
		else:
			print(cx, cy, ch)
			exit()


n = int(input())
xyh = [list(map(int, input().split())) for _ in range(n)]
(x_, y_, h_) = sorted(xyh, key=lambda x: x[2], reverse=True)[1]
for cx in range(101):
	for cy in range(101):
		H = h_ + abs(x_ - cx) + abs(y_ - cy)
		for (x, y, h) in xyh:
			if max(H - abs(x - cx) - abs(y - cy), 0) != h:
				break
		else:
			print(cx, cy, H)
			exit()


N = int(input())
hyx = [list(map(int, input().split()))[::-1] for _ in range(N)]
R = range(101)
for X in R:
	for Y in R:
		(h, y, x) = max(hyx)
		H = h + abs(X - x) + abs(Y - y)
		if all((h == max(H - abs(X - x) - abs(Y - y), 0) for (h, y, x) in hyx)):
			print(X, Y, H)


N = int(input())
Info = [[] for T in range(0, N)]
for I in range(0, N):
	Info[I] = [int(T) for T in input().split()]
Info = sorted(Info, reverse=True, key=lambda X: X[2])
for CX in range(0, 101):
	for CY in range(0, 101):
		Flag = True
		BaseH = abs(Info[0][0] - CX) + abs(Info[0][1] - CY) + Info[0][2]
		for I in range(1, N):
			if max(BaseH - abs(Info[I][0] - CX) - abs(Info[I][1] - CY), 0) != Info[I][2]:
				Flag = False
				break
		if Flag:
			Ans = [str(CX), str(CY), str(BaseH)]
			break
	if Flag:
		break
print(' '.join(Ans))


n = int(input())
li = [list(map(int, input().split())) for _ in range(n)]
li = sorted(li, key=lambda x: -x[2])
for i in range(101):
	for j in range(101):
		h = li[0][2] + abs(i - li[0][0]) + abs(j - li[0][1])
		for k in range(1, n):
			if li[k][2] != max(0, h - abs(i - li[k][0]) - abs(j - li[k][1])):
				break
		else:
			print('{} {} {}'.format(i, j, h))
			exit()


n = int(input())
xy = [[-1 for i in range(101)] for j in range(101)]
x = []
y = []
h = []
for i in range(n):
	(xx, yy, hh) = map(int, input().split())
	x.append(xx)
	y.append(yy)
	h.append(hh)
	if hh > 0:
		(x0, y0, h0) = (xx, yy, hh)
for i in range(101):
	for j in range(101):
		flg = 0
		tmp = h0 + abs(x0 - i) + abs(y0 - j)
		for k in range(n):
			if h[k] != max(tmp - abs(x[k] - i) - abs(y[k] - j), 0):
				flg = 1
				break
		if flg == 0:
			print(i, j, tmp)
			return


import sys
input = sys.stdin.readline
N = int(input())
piramids = []
for _ in range(N):
	(x, y, h) = map(int, input().split())
	piramids.append((x, y, h))
for cx in range(101):
	for cy in range(101):
		h_cands = set()
		for (x, y, h) in piramids:
			if h == 0:
				continue
			cand = h + abs(x - cx) + abs(y - cy)
			h_cands.add(cand)
		if len(h_cands) == 1:
			for (x, y, h) in piramids:
				if h != max(cand - abs(x - cx) - abs(y - cy), 0):
					break
			else:
				print(cx, cy, cand)
				return


N = int(input())
lst = [list(map(int, input().split())) for _ in range(N)]
for (x, y, h) in lst:
	if h != 0:
		break
for cx in range(101):
	for cy in range(101):
		H = abs(cx - x) + abs(cy - y) + h
		if all((hi == max(H - abs(cx - xi) - abs(cy - yi), 0) for (xi, yi, hi) in lst)):
			print(cx, cy, H)
			exit()


n = int(input())
xyh = [list(map(int, input().split())) for i in range(n)]
xyh.sort(key=lambda f: f[2])
p = xyh[-1]
for cx in range(0, 101):
	for cy in range(0, 101):
		h = p[2] + abs(p[0] - cx) + abs(p[1] - cy)
		for u in xyh:
			if u[2] != max(0, h - abs(u[0] - cx) - abs(u[1] - cy)):
				break
		else:
			print(cx, cy, h)


N = int(input())
xyh = [list(map(int, input().split())) for i in range(N)]
f = False
for x in range(101):
	for y in range(101):
		for i in range(N):
			if xyh[i][2] != 0:
				H = abs(xyh[i][0] - x) + abs(xyh[i][1] - y) + xyh[i][2]
				break
		for i in range(N):
			if xyh[i][2] == 0 and H - abs(xyh[i][0] - x) - abs(xyh[i][1] - y) > 0:
				break
			if xyh[i][2] != 0 and H != abs(xyh[i][0] - x) + abs(xyh[i][1] - y) + xyh[i][2]:
				break
		else:
			f = True
			break
	if f:
		break
print(x, y, H)


N = int(input())
XYH = [tuple(map(int, input().split())) for i in range(N)]
XYH.sort(key=lambda x: x[2])
(a, b, c) = XYH[-1]
import sys
for x in range(101):
	for y in range(101):
		H = abs(x - a) + abs(y - b) + c
		F = 1
		for i in range(N):
			if max(H - abs(x - XYH[i][0]) - abs(y - XYH[i][1]), 0) != XYH[i][2]:
				F = 0
				break
		if F:
			print(x, y, H)
			sys.exit()


n = int(input())
a = []
for i in range(n):
	a.append(list(map(int, input().split())))
a.sort(key=lambda x: (-x[2], x[0] + x[1]))
for i in range(101):
	for j in range(101):
		ansh = [0] * n
		for (k, (x, y, h)) in enumerate(a):
			ansh[k] = h + abs(i - x) + abs(j - y)
			if h == 0:
				ansh[k] = min([ansh[k], max(ansh[:k])])
		if len(set(ansh)) == 1:
			print(i, j, ansh[1])


N = int(input())
xyh = [list(map(int, input().split())) for _ in range(N)]
xyh = sorted(xyh, key=lambda x: -x[2])
(tx, ty, th) = xyh[0]
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()


N = int(input())
List = [[int(i) for i in input().split()] for _ in range(N)]
for (xt, yt, ht) in List:
	if ht > 0:
		break
for px in range(0, 101):
	for py in range(0, 101):
		H = ht + abs(px - xt) + abs(py - yt)
		if len(list(filter(lambda x: x[2] != max(H - abs(px - x[0]) - abs(py - x[1]), 0), List))) == 0:
			print(px, py, H)
			break
	else:
		continue
	break


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()


N = int(input())
L = [list(map(int, input().split())) for i in range(N)]
L.sort(key=lambda x: x[2], reverse=True)
for i in range(101):
	for j in range(101):
		s = L[0][2] + abs(i - L[0][0]) + abs(j - L[0][1])
		for l in L[1:]:
			h = l[2] + abs(i - l[0]) + abs(j - l[1])
			if s == h:
				continue
			elif l[2] == 0 and s < h:
				continue
			else:
				break
		else:
			print(i, j, s)
			exit()


n = int(input())
lst = []
for i in range(n):
	a = list(map(int, input().split()))
	if a[2] != 0:
		lst.append(a)
if len(lst) == 1:
	print(*lst[0])
	exit()
for i in range(101):
	for j in range(101):
		h = abs(i - lst[0][0]) + abs(j - lst[0][1]) + lst[0][2]
		for k in lst[1:]:
			if h != abs(i - k[0]) + abs(j - k[1]) + k[2]:
				break
		else:
			print(i, j, h)
			exit()


N = int(input())
L = [list(map(int, input().split())) for k in range(N)]
m = 0
for l in L:
	m = max(m, l[2])
for x in range(101):
	for y in range(101):
		for h in range(m, m + 101):
			f = 1
			for l in L:
				if l[2] != max(h - abs(l[0] - x) - abs(l[1] - y), 0):
					f = 0
					break
			if f:
				print(x, y, h)
				exit(0)


from itertools import product
n = int(input())
pos = [[int(x) for x in input().split(' ')] for _ in range(n)]
for (cx, cy) in product(range(101), range(101)):
	H = max(max([abs(p[0] - cx) + abs(p[1] - cy) + p[2] for p in pos if p[2] != 0]), 1)
	if all((max(H - abs(p[0] - cx) - abs(p[1] - cy), 0) == p[2] for p in pos)):
		print(cx, cy, H)
		exit()


N = int(input())
l = []
for i in range(N):
	l.append(list(map(int, input().split())))
for x in range(101):
	for y in range(101):
		flag = True
		for i in range(N):
			if l[i][2] > 0:
				tmp = abs(x - l[i][0]) + abs(y - l[i][1]) + l[i][2]
				break
		for i in range(N):
			if l[i][2] != max(tmp - abs(x - l[i][0]) - abs(y - l[i][1]), 0):
				flag = False
				break
		if flag:
			print(x, y, tmp)
			return


f = lambda : map(int, input().split())
n = int(input())
(lh, lz) = ([], [])
for _ in range(n):
	(x, y, h) = f()
	if h:
		lh += [(x, y, h)]
	else:
		lz += [(x, y)]
for X in range(101):
	for Y in range(101):
		(x, y, h) = lh[0]
		H = h + abs(x - X) + abs(y - Y)
		for (x, y, h) in lh:
			if H != h + abs(x - X) + abs(y - Y):
				break
		else:
			if all((H - abs(x - X) - abs(y - Y) < 1 for (x, y) in lz)):
				print(X, Y, H)


n = int(input())
XYH = []
for i in range(n):
	(x, y, h) = map(int, input().split())
	XYH.append([x, y, h])
XYH.sort(key=lambda x: x[2])
for i in range(101):
	for j in range(101):
		peak = abs(i - XYH[-1][0]) + abs(j - XYH[-1][1]) + XYH[-1][2]
		flag = 1
		for k in range(n - 1):
			if max(0, peak - abs(i - XYH[k][0]) - abs(j - XYH[k][1])) != XYH[k][2]:
				flag = 0
		if flag == 1:
			Ans = [i, j, peak]
print(*Ans)


n = int(input())
zahyo = [list(map(int, input().split())) for i in range(n)]
zahyo.sort(key=lambda x: x[2], reverse=1)
(mx, my, mh) = zahyo[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 zahyo)):
			print(Cx, Cy, H)
			break


import sys
from heapq import heappush, heappop

def input():
	return sys.stdin.readline().rstrip()

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(mi())

def main():
	n = ii()
	x = [0] * n
	y = [0] * n
	h = [0] * n
	for i in range(n):
		(x[i], y[i], h[i]) = mi()
	idx = h.index(max(h))
	for cx in range(101):
		for cy in range(101):
			flag = True
			H = abs(cx - x[idx]) + abs(cy - y[idx]) + h[idx]
			for i in range(n):
				tmp = abs(cx - x[i]) + abs(cy - y[i])
				if h[i] == 0:
					flag &= tmp >= H
				else:
					tmp += h[i]
					flag &= tmp == H
			if flag:
				print(cx, cy, H)
				return

def __starting_point():
	main()
__starting_point()


n = int(input())
xyh = [list(map(int, input().split())) for _ in range(n)]
(x0, y0, h0) = (0, 0, 0)
for (x, y, h) in xyh:
	if h > 0:
		(x0, y0, h0) = (x, y, h)
		break
for cx in range(101):
	for cy in range(101):
		h = h0 + abs(cx - x0) + abs(cy - y0)
		flg = True
		for (xi, yi, hi) in xyh:
			if hi != max(h - abs(cx - xi) - abs(cy - yi), 0):
				flg = False
		if flg:
			print(cx, cy, h)


N = int(input())
d = {}
for i in range(N):
	(x, y, h) = map(int, input().split())
	d[tuple([x, y])] = h
for i in range(101):
	for j in range(101):
		h = -1
		for p in d:
			if d[p] != 0:
				h = max(h, abs(p[0] - i) + abs(p[1] - j) + d[p])
		f = True
		for p in d:
			if d[p] != max(0, h - abs(p[0] - i) - abs(p[1] - j)):
				f = False
				break
		if f == True:
			print(i, j, h)


N = int(input())
xyh = [list(map(int, input().split())) for i in range(N)]
for i in range(N):
	if xyh[i][2] != 0:
		(xs, ys, hs) = xyh[i]
for xt in range(101):
	for yt in range(101):
		ht = hs + abs(xt - xs) + abs(yt - ys)
		if all([xyh[i][2] == max(0, ht - abs(xt - xyh[i][0]) - abs(yt - xyh[i][1])) for i in range(N)]):
			(xa, ya, ha) = (xt, yt, ht)
print(xa, ya, ha)


n = int(input())
a = []
h = []
for i in range(n):
	arr = list(map(int, input().split()))
	h.append(arr[2])
	a.append(arr)
l = [i for i in a if i[2] > 0]
xt = l[0][0]
yt = l[0][1]
ht = l[0][2]
for i in range(101):
	for j in range(101):
		h_ans = ht + abs(xt - i) + abs(yt - j)
		if all((max(h_ans - abs(l[0] - i) - abs(l[1] - j), 0) == l[2] for l in a)):
			print(i, j, h_ans)
			exit()


n = int(input())
l = []
for i in range(n):
	(a, b, c) = map(int, input().split())
	l.append((a, b, c))
	if c > 0:
		(x, y, h) = (a, b, c)
ma = len(l)
for s in range(101):
	for t in range(101):
		(x2, y2, h2) = (s, t, h + abs(x - s) + abs(y - t))
		c = 0
		if all((h3 == max(h2 - abs(x3 - x2) - abs(y3 - y2), 0) for (x3, y3, h3) in l)):
			print(x2, y2, h2)
			exit()
print(-1, -1, -1)


n = int(input())
(x, y, h) = ([0] * n, [0] * n, [0] * n)
for i in range(n):
	(x[i], y[i], h[i]) = map(int, input().split())
mn_h = min(h)
mx_h = max(h)
for C_x in range(101):
	for C_y in range(101):
		for i in range(n):
			H = h[i] + abs(x[i] - C_x) + abs(y[i] - C_y)
			if H > 0:
				if all((max(H - abs(x[j] - C_x) - abs(y[j] - C_y), 0) == h[j] for j in range(n))):
					print(C_x, C_y, H)
					exit()


n = int(input())
xyh = sorted([list(map(int, input().split())) for i in range(n)], key=lambda x: -x[2])
for x in range(101):
	for y in range(101):
		h = xyh[0][2] + abs(x - xyh[0][0]) + abs(y - xyh[0][1])
		flag = True
		for (X, Y, H) in xyh[1:]:
			if H != max(h - abs(x - X) - abs(y - Y), 0):
				flag = False
				break
		if flag:
			print(x, y, h)
			exit()


def dist(h, xi, yi, cx, cy):
	return h + abs(xi - cx) + abs(yi - cy)
N = int(input())
P = []
for i in range(N):
	(xi, yi, h) = map(int, input().split())
	P.append([h, xi, yi])
P.sort(reverse=True)
for i in range(101):
	for j in range(101):
		H = dist(P[0][0], P[0][1], P[0][2], i, j)
		for p in P[1:]:
			if max(H - abs(p[1] - i) - abs(p[2] - j), 0) != p[0]:
				break
		else:
			print(i, j, H)
			break


from itertools import *
n = int(input())
xyh = []
for i in range(n):
	xyh += [list(map(int, input().split()))]
xyh.sort(reverse=True, key=lambda x: x[2])
[x0, y0, h0] = xyh[0]
for (x, y) in product(range(0, 101), range(0, 101)):
	h = h0 + abs(x - x0) + abs(y - y0)
	for k in xyh[1:]:
		if k[2] != max(h - abs(x - k[0]) - abs(y - k[1]), 0):
			break
	else:
		break
print(x, y, h)


n = int(input())
ans = [[cx, cy, -1] for cx in range(101) for cy in range(101)]
zeroes = []
for i in range(n):
	(x, y, h) = list(map(int, input().split()))
	if h > 0:
		delete = []
		for j in range(len(ans)):
			(cx, cy, ch) = ans[j]
			calcH = h + abs(x - cx) + abs(y - cy)
			if ch == -1:
				ans[j][2] = calcH
			elif ch != calcH:
				delete.append(j)
		while len(delete) > 0:
			del ans[delete.pop()]
	else:
		zeroes.append([x, y])
for (x, y) in zeroes:
	delete = []
	for j in range(len(ans)):
		(cx, cy, ch) = ans[j]
		if ch - abs(x - cx) - abs(y - cy) > 0:
			delete.append(j)
	while len(delete) > 0:
		del ans[delete.pop()]
print(' '.join(map(str, ans[0])))


def main():
	N = int(input())
	info = []
	for i in range(N):
		(x, y, h) = [int(a) for a in input().split(' ')]
		info.append({'x': x, 'y': y, 'h': h})
	info.sort(key=lambda f: -f['h'])
	for cx in range(101):
		for cy in range(101):
			H = 0
			for i in range(len(info)):
				h = info[i]['h'] + abs(info[i]['x'] - cx) + abs(info[i]['y'] - cy)
				if i == 0:
					H = h
				elif h != H:
					if info[i]['h'] == 0 and h < H or info[i]['h'] > 0:
						break
			else:
				print(cx, cy, H)
				return 0
	if info[0]['x'] in [0, 100] and info[0]['y'] in [0, 100]:
		print(info[0]['x'], info[0]['y'], info[0]['h'])
		return 0
main()


n = int(input())
xyh = [list(map(int, input().split())) for i in range(n)]
xyh.sort(key=lambda x: x[2], reverse=True)
for cx in range(0, 101):
	for cy in range(0, 101):
		(x0, y0, h0) = xyh[0]
		H = h0 + abs(x0 - cx) + abs(y0 - cy)
		if H == 0:
			continue
		flag = True
		for (x, y, h) in xyh:
			if h != max(H - abs(x - cx) - abs(y - cy), 0):
				flag = False
		if flag:
			print(cx, cy, H)
			exit()


n = int(input())
p = [[int(i) for i in input().split()] for i in range(n)]
p.sort(key=lambda x: x[2])
(a, b, c) = p[-1]
f = 0
for cx in range(101):
	for cy in range(101):
		h = c + abs(a - cx) + abs(b - cy)
		if all((k == max(h - abs(i - cx) - abs(j - cy), 0) for (i, j, k) in p)):
			f = 1
		if f:
			break
	if f:
		break
print(cx, cy, h)


N = int(input())
xyh = [list(map(int, input().split())) for _ in range(N)]
hxy = [[h, x, y] for (x, y, h) in xyh]
hxy.sort()
for X in range(101):
	for Y in range(101):
		(h, x, y) = hxy[-1]
		H = h + abs(X - x) + abs(Y - y)
		if all((h == max(H - abs(X - x) - abs(Y - y), 0) for (h, x, y) in hxy)):
			print(X, Y, H)


N = int(input())
XYs = []
for _ in range(N):
	XYs.append(list(map(int, input().split())))
for i in range(101):
	for j in range(101):
		f = 1
		for k in range(N):
			if XYs[k][2] > 0:
				h = XYs[k][2] + abs(XYs[k][0] - i) + abs(XYs[k][1] - j)
				break
		for k in range(N):
			if max(h - abs(XYs[k][0] - i) - abs(XYs[k][1] - j), 0) != XYs[k][2]:
				f = 0
				break
		if f == 1:
			print(i, j, h)
			return


n = int(input())
coords = [tuple(map(int, input().split())) for i in range(n)]
for (xt, yt, ht) in coords:
	if ht != 0:
		break
(x, y, h) = (-1, -1, -1)
for px in range(101):
	for py in range(101):
		flag = True
		htmp = ht + abs(px - xt) + abs(py - yt)
		dxdy = [(abs(px - x1) + abs(py - y1), htmp - h1) for (x1, y1, h1) in coords]
		dxdy.sort()
		for i in range(n - 1):
			if dxdy[i][0] < dxdy[i + 1][0] and dxdy[i][1] > dxdy[i + 1][1]:
				flag = False
				break
		for (x1, y1, h1) in coords:
			if h1 == 0:
				continue
			if abs(htmp - h1) != abs(px - x1) + abs(py - y1):
				flag = False
				break
		if flag:
			if htmp > h:
				h = htmp
				x = px
				y = py
print(x, y, h)


n = int(input())
arr = []
for i in range(n):
	(x, y, h) = map(int, input().split())
	if h >= 1:
		(X, Y, H) = (x, y, h)
	arr.append([x, y, h])

def d(a, b, c, d):
	return abs(c - a) + abs(d - b)
for i in range(101):
	for j in range(101):
		H0 = d(i, j, X, Y) + H
		flag = 1
		for l in arr:
			if l[2] != max(0, H0 - d(i, j, l[0], l[1])):
				flag = 0
				break
		if flag == 1:
			print(i, j, H0)
			quit()


n = int(input())
p = [list(map(int, input().split())) for _ in range(n)]
p.sort(key=lambda x: x[2], reverse=True)
for cx in range(101):
	for cy in range(101):
		(x0, y0, h0) = p[0]
		h = abs(x0 - cx) + abs(y0 - cy) + h0
		if all((max(h - abs(xi - cx) - abs(yi - cy), 0) == hi for (xi, yi, hi) in p)):
			print(cx, cy, h)
			exit()


import sys
n = int(input())
lst = []
for i in range(n):
	(x, y, h) = map(int, input().split())
	lst.append([x, y, h])
for j in range(101):
	for k in range(101):
		for i in range(n):
			H = abs(j - lst[i][0]) + abs(k - lst[i][1]) + lst[i][2]
			if H > 0:
				if all((max(H - abs(j - lst[l][0]) - abs(k - lst[l][1]), 0) == lst[l][2] for l in range(n))):
					print(j, k, H)
					sys.exit()


import sys
from itertools import product
input = sys.stdin.readline

def main():
	N = int(input())
	X = [0] * N
	Y = [0] * N
	H = [0] * N
	for i in range(N):
		(X[i], Y[i], H[i]) = list(map(int, input().split()))
	for (Cx, Cy) in product(list(range(101)), repeat=2):
		Ch = set()
		Ch_upper = float('inf')
		for (x, y, h) in zip(X, Y, H):
			a = abs(x - Cx) + abs(y - Cy)
			if h == 0:
				Ch_upper = min(Ch_upper, a)
			else:
				Ch.add(h + a)
		if len(Ch) != 1:
			continue
		else:
			Ch = Ch.pop()
			if Ch <= Ch_upper:
				ans = f'{Cx} {Cy} {Ch}'
				break
	print(ans)

def __starting_point():
	main()
__starting_point()


n = int(input())
hs = [list(map(int, input().split())) for _ in range(n)]
hs.sort(key=lambda x: x[2], reverse=True)

def main():
	for x in range(101):
		for y in range(101):
			height = hs[0][2] + abs(x - hs[0][0]) + abs(y - hs[0][1])
			for i in range(1, n):
				if max(height - (abs(x - hs[i][0]) + abs(y - hs[i][1])), 0) == hs[i][2]:
					pass
				else:
					break
				if i == n - 1:
					print(x, y, height)
					return (x, y, height)
main()


import sys
n = int(input())
xyh = []
for _ in range(n):
	xyh.append(list(map(int, input().split())))
for Cx in range(101):
	for Cy in range(101):
		for (x, y, h) in xyh:
			if h == 0:
				continue
			H = h + abs(x - Cx) + abs(y - Cy)
			break
		ok = True
		for (x, y, h) in xyh:
			if max(H - abs(x - Cx) - abs(y - Cy), 0) != h:
				ok = False
				break
		if ok:
			print('{} {} {}'.format(Cx, Cy, H))
			sys.exit(0)


n = int(input())
p = []
for i in range(n):
	(ta, tb, tc) = map(int, input().split())
	p.append([ta, tb, tc])
p.sort(key=lambda x: x[2])
(a, b, c) = p[-1]
for y in range(101):
	for x in range(101):
		h = c + abs(a - x) + abs(b - y)
		if all((k == max(h - abs(i - x) - abs(y - j), 0) for (i, j, k) in p)):
			print(x, y, h)
			exit()


N = int(input())
xyh = [list(map(int, input().strip().split())) for _ in range(N)]
dp = [[-1 for i in range(101)] for j in range(101)]
for n in range(N):
	dp[xyh[n][0]][xyh[n][1]] = xyh[n][2]

def find_top(x, y, N, xyh):
	find = True
	prev = -1
	for n in range(N):
		if xyh[n][2] != 0:
			top = xyh[n][2] + abs(xyh[n][0] - x) + abs(xyh[n][1] - y)
			if prev == -1:
				prev = top
			elif prev != top:
				find = False
				break
	return (find, top)

def check_top(x, y, top, N, xyh):
	check = True
	for n in range(N):
		if xyh[n][2] == 0:
			if top - abs(xyh[n][0] - x) - abs(xyh[n][1] - y) > 0:
				check = False
				break
	return check
fin = False
for x in range(101):
	if fin == True:
		break
	for y in range(101):
		find = find_top(x, y, N, xyh)[0]
		height = find_top(x, y, N, xyh)[1]
		if find and height >= 1 and check_top(x, y, height, N, xyh):
			print('{} {} {}'.format(x, y, height))
			fin = True


n = int(input())
xyh = []
for i in range(n):
	xyh1 = [int(i) for i in input().split()]
	xyh.append(xyh1)
xyh.sort(key=lambda x: x[2])
(xm, ym, hm) = xyh[-1]
for cx in range(101):
	for cy in range(101):
		H = hm + abs(xm - cx) + abs(ym - cy)
		if all((h == max(H - abs(x - cx) - abs(y - cy), 0) for (x, y, h) in xyh)):
			print(cx, cy, H)
			exit()


n = int(input())
infolist = []
for i in range(n):
	infolist.append([int(x) for x in input().split()])
center = []
for x in infolist:
	if x[2] != 0:
		(x1, y1, h1) = x
		break
for i in range(101):
	for j in range(101):
		H = h1 + abs(x1 - i) + abs(y1 - j)
		if all((h == max(H - abs(x - i) - abs(y - j), 0) for (x, y, h) in infolist)):
			print(i, j, H)


n = int(input())
a = []
for i in range(n):
	a.append([int(n) for n in input().split()])
	(a[i][0], a[i][2]) = (a[i][2], a[i][0])
a = sorted(a)
for x in range(101):
	for y in range(101):
		h = a[n - 1][0] + abs(x - a[n - 1][2]) + abs(y - a[n - 1][1])
		for k in range(n):
			d = h - abs(x - a[k][2]) - abs(y - a[k][1])
			if a[k][0] != max(d, 0):
				break
			if k == n - 1:
				print(x, y, h)
				exit()


N = int(input())
points = [list(map(int, input().split())) for _ in range(N)]
p = points[0][0]
q = points[0][1]
r = points[0][2]
points.sort(key=lambda x: x[2], reverse=True)
for i in range(0, 101):
	for j in range(0, 101):
		H = points[0][2] + abs(points[0][0] - i) + abs(points[0][1] - j)
		for (x, y, z) in points:
			if z != max(H - abs(x - i) - abs(y - j), 0):
				break
		else:
			print(i, j, H)


n = int(input())
xyh = [list(map(int, input().split())) for i in range(n)]
xyh.sort(key=lambda x: -x[2])
for cx in range(101):
	for cy in range(101):
		good = True
		h = xyh[0][2] + abs(cx - xyh[0][0]) + abs(cy - xyh[0][1])
		for i in range(n):
			if xyh[i][2] != max(h - abs(cx - xyh[i][0]) - abs(cy - xyh[i][1]), 0):
				good = False
				break
		if good:
			print(cx, cy, h)
			exit()


n = int(input())
l = [list(map(int, input().split())) for i in range(n)]
for x in range(101):
	for y in range(101):
		k = set((e + abs(x - q) + abs(w - y) for (q, w, e) in l if e))
		for pre in k:
			for (a, s, d) in l:
				if d != max(0, pre - abs(x - a) - abs(s - y)):
					break
			else:
				print(x, y, pre)
				exit()


n = int(input())
ab = [list(map(int, input().split())) for _ in range(n)]
for _ in range(0, n):
	if ab[_][2] != 0:
		x = ab[_][0]
		y = ab[_][1]
		h = ab[_][2]
		break
for i in range(101):
	for j in range(101):
		f = True
		l = abs(i - x) + abs(j - y) + h
		for k in range(0, n):
			dx = ab[k][0]
			dy = ab[k][1]
			dh = ab[k][2]
			if max(l - abs(i - dx) - abs(j - dy), 0) == dh:
				pass
			else:
				f = False
		if f:
			ansx = i
			ansy = j
			ansr = l
			break
print(str(ansx) + ' ' + str(ansy) + ' ' + str(ansr))


n = int(input())
xyh = [list(map(int, input().split()))[::-1] for _ in range(n)]
xyh.sort(reverse=1)
for xx in range(101):
	for yy in range(101):
		f = True
		hh = xyh[0][0] + abs(xx - xyh[0][2]) + abs(yy - xyh[0][1])
		for (h, y, x) in xyh[1:]:
			if max(hh - abs(x - xx) - abs(y - yy), 0) != h:
				f = False
		if f:
			print(xx, yy, hh)
			exit()


N = int(input())
xyh = [list(map(int, input().split())) for i in range(N)]
xyh.sort(reverse=True, key=lambda x: x[2])
for i in range(101):
	for j in range(101):
		H = xyh[0][2] + abs(i - xyh[0][0]) + abs(j - xyh[0][1])
		cnt = 1
		for k in range(1, N):
			if max(H - (abs(i - xyh[k][0]) + abs(j - xyh[k][1])), 0) == xyh[k][2]:
				cnt += 1
			else:
				break
		if cnt == N:
			print(i, j, H)
			exit()


N = int(input())
(X, Y, H) = ([], [], [])
for i in range(N):
	(XX, YY, HH) = map(int, input().split())
	X.append(XX)
	Y.append(YY)
	H.append(HH)
for i in range(101):
	for j in range(101):
		ans = 1
		m = 0
		for l in range(N):
			if H[l] != 0:
				m = abs(X[l] - i) + abs(Y[l] - j) + H[l]
				break
		for k in range(N):
			if max(m - abs(X[k] - i) - abs(Y[k] - j), 0) != H[k]:
				ans = 0
		if ans:
			print(i, j, m)
			break


N = int(input())
xyhs = []
for i in range(N):
	(x, y, h) = map(int, input().split())
	xyhs.append((x, y, h))
(x0, y0, h0) = max(xyhs, key=lambda xyh: xyh[2])
for cx in range(0, 101):
	for cy in range(0, 101):
		H = h0 + abs(x0 - cx) + abs(y0 - cy)
		ok = True
		for (x, y, h) in xyhs:
			if h != max(0, H - abs(x - cx) - abs(y - cy)):
				ok = False
				break
		if ok:
			print(cx, cy, H)
			exit()
print(-1)


a = abs
z = [list(map(int, input().split())) for _ in range(int(input()))]
z.sort(key=lambda x: x[2])
(x, y, h) = z[-1]
r = range(101)
for c in r:
	for d in r:
		H = h + a(c - x) + a(d - y)
		if all((u == max(H - a(s - c) - a(t - d), 0) for (s, t, u) in z)):
			print(c, d, H)
			exit()


n = int(input())
xyh = []
(x0, y0, h0) = (None, None, None)
for _ in range(n):
	(x, y, h) = map(int, input().split())
	if h > 0 and x0 is None:
		(x0, y0, h0) = (x, y, h)
	xyh.append([x, y, h])
for cx in range(101):
	for cy in range(101):
		h = h0 + abs(x0 - cx) + abs(y0 - cy)
		done = True
		for (xk, yk, hk) in xyh:
			h_ = max(h - abs(xk - cx) - abs(yk - cy), 0)
			if h_ != hk:
				done = False
				break
		if done:
			print(f'{cx} {cy} {h}')


N = int(input())
xyh = []
for i in range(N):
	xyh.append([int(i) for i in input().split()])
for (x, y, h) in xyh:
	if h != 0:
		(xs, ys, hs) = (x, y, h)
for cx in range(100 + 1):
	for cy in range(100 + 1):
		guessed_H = hs + abs(xs - cx) + abs(ys - cy)
		if all([max(0, guessed_H - abs(cx - x) - abs(cy - y)) == h for (x, y, h) in xyh]):
			print(cx, cy, guessed_H)


n = int(input())
alist = [list(map(int, input().split())) for i in range(n)]
alist.sort(key=lambda x: x[2], reverse=True)
for i in range(101):
	for j in range(101):
		h = abs(alist[0][0] - i) + abs(alist[0][1] - j) + alist[0][2]
		ans = True
		for k in range(n):
			if max(h - abs(alist[k][0] - i) - abs(alist[k][1] - j), 0) != alist[k][2]:
				ans = False
		if ans:
			ansx = i
			ansy = j
			ansh = h
print(ansx, ansy, ansh)


N = int(input())
xyh = [list(map(int, input().split()[:3])) for _ in range(N)]
(ax, ay, ah) = list(filter(lambda x: x[2], xyh))[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 xyh)):
			print(x, y, H)


i = lambda : list(map(int, input().split()))
(N,) = i()
M = [i() for j in range(N)]
k = -1
for k in range(len(M)):
	if M[k][2] > 0:
		break
for Cx in range(101):
	for Cy in range(101):
		H = abs(M[k][0] - Cx) + abs(M[k][1] - Cy) + M[k][2]
		if all([False for d in M if d[2] != max(H - abs(d[0] - Cx) - abs(d[1] - Cy), 0)]):
			print(Cx, Cy, H)
			break


N = int(input())
XYH = [[int(i) for i in input().split()] for j in range(N)]
search = 0
while XYH[search][2] == 0:
	search += 1
for X in range(101):
	for Y in range(101):
		H = XYH[search][2] + abs(X - XYH[search][0]) + abs(Y - XYH[search][1])
		for (x, y, h) in XYH:
			if h != max(H - abs(X - x) - abs(Y - y), 0):
				break
		else:
			print(X, Y, H)
			exit()


n = int(input())
l = [list(map(int, input().split())) for i in range(n)]
for w in range(n):
	if l[w][2] > 0:
		k = w
		break
for x in range(101):
	for y in range(101):
		a = l[k][2] + abs(l[k][0] - x) + abs(l[k][1] - y)
		c = 0
		for z in range(n):
			if max(a - abs(l[z][0] - x) - abs(l[z][1] - y), 0) == l[z][2]:
				c += 1
			if c == n:
				print(x, y, a)


n = int(input())
xyh = []
for i in range(n):
	(x, y, h) = map(int, input().split())
	xyh.append((x, y, h))

def dis(a, b):
	return abs(a[0] - b[0]) + abs(a[1] - b[1])
for i in range(101):
	for j in range(101):
		for k in range(n):
			if xyh[k][2] != 0:
				kari = dis(xyh[k], (i, j)) + xyh[k][2]
				break
		f = 1
		for k in range(n):
			if xyh[k][2] != max(kari - dis(xyh[k], (i, j)), 0):
				f = 0
				break
		if f:
			print(i, j, kari)
			exit()


N = int(input())
L = [list(map(int, input().split())) for k in range(N)]
m = 0
for e in L:
	m = max(m, e[2])

def check(x, y, h):
	for e in L:
		if e[2] != max(h - abs(e[0] - x) - abs(e[1] - y), 0):
			return False
	return True
for x in range(101):
	for y in range(101):
		for h in range(m, m + 101):
			if check(x, y, h) == True:
				print(x, y, h)
				exit(0)


n = int(input())
xyhs = [list(map(int, input().split())) for _ in range(n)]
xyhs.sort(key=lambda i: i[2], reverse=True)
for cx in range(101):
	for cy in range(101):
		(x, y, h) = xyhs[0]
		ch = h + abs(cy - y) + abs(cx - x)
		if all([h == max(ch - abs(cy - y) - abs(cx - x), 0) for (x, y, h) in xyhs[1:]]):
			print(cx, cy, ch)
			exit()


S = int(input())
L = [list(map(int, input().split())) for i in range(S)]
for i in range(S):
	if L[i][2] != 0:
		for cx in range(101):
			for cy in range(101):
				ans = 0
				hpre = L[i][2] + abs(L[i][0] - cx) + abs(L[i][1] - cy)
				for j in range(S):
					if max(hpre - abs(cx - L[j][0]) - abs(cy - L[j][1]), 0) == L[j][2]:
						ans += 1
				if ans == S:
					print(cx, cy, hpre)
					exit()


n = int(input())
hoge = []
for i in range(n):
	(x, y, z) = map(int, input().split())
	if z != 0:
		hoge.append([x, y, z])
if len(hoge) == 1:
	print(*hoge[0])
	exit()
for i in range(101):
	for j in range(101):
		h = []
		for k in range(len(hoge)):
			h.append(hoge[k][2] + abs(hoge[k][0] - i) + abs(hoge[k][1] - j))
		if h.count(h[0]) == len(h):
			print(i, j, h[0])


n = int(input())
l = [tuple(map(int, input().split())) for _ in range(n)]
for (x, y, h) in l:
	if h:
		kx = x
		ky = y
		kh = h
		break
for cx in range(101):
	for cy in range(101):
		ch = kh + abs(cx - kx) + abs(cy - ky)
		for (x, y, h) in l:
			if max(0, ch - abs(cx - x) - abs(cy - y)) != h:
				break
		else:
			print(cx, cy, ch)
			exit(0)


n = int(input())
z = [0] * n
for i in range(n):
	(x, y, h) = map(int, input().split())
	if h != 0:
		k = [x, y, h]
	z[i] = [x, y, h]
for i in range(101):
	for j in range(101):
		H = k[2] + abs(k[0] - i) + abs(k[1] - j)
		for l in z:
			if l[2] != max(H - abs(l[0] - i) - abs(l[1] - j), 0):
				break
			if l == z[-1]:
				print(i, j, H)
				exit()


n = int(input())
(x, y, h) = ([], [], [])
for i in range(n):
	(X, Y, H) = map(int, input().split())
	x.append(X)
	y.append(Y)
	h.append(H)
for X in range(101):
	for Y in range(101):
		for i in range(n):
			H = h[i] + abs(x[i] - X) + abs(y[i] - Y)
			if all((h[j] == max(H - abs(x[j] - X) - abs(y[j] - Y), 0) for j in range(n))):
				print(X, Y, H)
				break


l = sorted([[*map(int, input().split())] for _ in range(int(input()))], key=lambda k: -k[2])
(x, y, h) = l[0]
for X in range(101):
	for Y in range(101):
		H = h + abs(x - X) + abs(y - Y)
		if all((h == max(H - abs(x - X) - abs(y - Y), 0) for (x, y, h) in l)):
			print(X, Y, H)


n = int(input())
x = [0] * n
y = [0] * n
h = [0] * n
for i in range(n):
	(x[i], y[i], h[i]) = map(int, input().split())
import sys
ind = h.index(max(h))
for cx in range(0, 101):
	for cy in range(0, 101):
		H_calc = h[ind] + abs(x[ind] - cx) + abs(y[ind] - cy)
		for i in range(n):
			if max(H_calc - abs(x[i] - cx) - abs(y[i] - cy), 0) != h[i]:
				break
		else:
			print(cx, cy, H_calc)
			sys.exit()


n = int(input())
a = []
for i in range(n):
	_ = list(map(int, input().split()))
	a.append(_)
a = sorted(a, key=lambda x: x[2], reverse=True)
check = False
for i in range(101):
	for j in range(101):
		b = 0
		while b < n:
			if b == 0:
				h = abs(i - a[b][0]) + abs(j - a[b][1]) + a[b][2]
				b += 1
			else:
				de = max(h - abs(i - a[b][0]) - abs(j - a[b][1]), 0)
				if de == a[b][2]:
					b += 1
				else:
					break
		if b == n:
			ans = str(i) + ' ' + str(j) + ' ' + str(h)
			check = True
		if check:
			break
	if check:
		break
print(ans)


n = int(input())
xyh = [list(map(int, input().split())) for _ in range(n)]
for i in range(101):
	for j in range(101):
		s = -1
		flag = True
		limit = float('inf')
		for (x, y, h) in xyh:
			if h != 0:
				H = h + abs(x - i) + abs(y - j)
				if s != -1:
					if s != H:
						flag = False
						break
				s = H
			else:
				limit = min(limit, abs(x - i) + abs(y - j))
		if flag:
			if s != -1 and s <= limit:
				print(i, j, s)
				return
			elif s <= limit and limit == 1:
				print(i, j, 1)
				return