import sys

import heapq

from operator import itemgetter

from collections import deque, defaultdict

from bisect import bisect_left, bisect_right

input = sys.stdin.readline

sys.setrecursionlimit(10 ** 7)



def sol():

    N = int(eval(input()))

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

    points.sort(key=itemgetter(2), reverse=True)



    for cx in range(101):

        for cy in range(101):

            bx, by, bh = points[0]

            H = bh + abs(cx - bx) + abs(cy - by)

            for x, y, h in points:

                nowH = max(H - abs(cx - x) - abs(cy - y), 0)

                if h != nowH:

                    break

            else:

                print((cx, cy, H))

                return



sol()
N = int(eval(input()))

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

bx, by, bh = [xyh for xyh in XYH if xyh[2] > 0][0]



def solve(cx, cy):

    H = abs(cx - bx) + abs(cy - by) + bh



    for x, y, h in XYH:

        D = max(0, H - abs(cx - x) - abs(cy - y))

        if D != h:

            return 0

    return H



for x in range(101):

    for y in range(101):

        h = solve(x, y)

        if h > 0:

            print((x, y, h))

            exit()



print((-1))

import sys
import heapq
from operator import itemgetter
from collections import deque, defaultdict
from bisect import bisect_left, bisect_right

input = sys.stdin.readline
sys.setrecursionlimit(10**7)


def sol():
    N = int(eval(input()))
    points = [tuple(map(int, input().split())) for _ in range(N)]
    points.sort(key=itemgetter(2), reverse=True)
    for cx in range(101):
        for cy in range(101):
            bx, by, bh = points[0]
            H = bh + abs(cx - bx) + abs(cy - by)
            for x, y, h in points:
                nowH = max(H - abs(cx - x) - abs(cy - y), 0)
                if h != nowH:
                    break
            else:
                print((cx, cy, H))
                return


sol()

N = int(eval(input()))
XYH = [tuple(map(int, input().split())) for _ in range(N)]
bx, by, bh = [xyh for xyh in XYH if xyh[2] > 0][0]


def solve(cx, cy):
    H = abs(cx - bx) + abs(cy - by) + bh
    for x, y, h in XYH:
        D = max(0, H - abs(cx - x) - abs(cy - y))
        if D != h:
            return 0
    return H


for x in range(101):
    for y in range(101):
        h = solve(x, y)
        if h > 0:
            print((x, y, h))
            exit()
print((-1))

-import sys -import heapq -from operator import itemgetter -from collections import deque, defaultdict -from bisect import bisect_left, bisect_right - -input = sys.stdin.readline -sys.setrecursionlimit(10**7) +N = int(eval(input())) +XYH = [tuple(map(int, input().split())) for _ in range(N)] +bx, by, bh = [xyh for xyh in XYH if xyh[2] > 0][0] -def sol(): -    N = int(eval(input())) -    points = [tuple(map(int, input().split())) for _ in range(N)] -    points.sort(key=itemgetter(2), reverse=True) -    for cx in range(101): -        for cy in range(101): -            bx, by, bh = points[0] -            H = bh + abs(cx - bx) + abs(cy - by) -            for x, y, h in points: -                nowH = max(H - abs(cx - x) - abs(cy - y), 0) -                if h != nowH: -                    break -            else: -                print((cx, cy, H)) -                return +def solve(cx, cy): +    H = abs(cx - bx) + abs(cy - by) + bh +    for x, y, h in XYH: +        D = max(0, H - abs(cx - x) - abs(cy - y)) +        if D != h: +            return 0 +    return H -sol() +for x in range(101): +    for y in range(101): +        h = solve(x, y) +        if h > 0: +            print((x, y, h)) +            exit() +print((-1))