Buggy python submission (verdict: Runtime Error):
N = int(input())
xyh = [list(map(int, input().split())) for _ in range(N)]

for x in range(101):
    for y in range(101):
        check = []
        for d in xyh:
            ifd0 = False
            if d[2] == 0:
                ifd0 = True
            ch = abs(d[0] - x) + abs(d[1] - y) + d[2]
            check.append([ch, ifd0])
        ifans = True
        for c in check:
            if c[0] - check[0][0] != 0:
                if ifd0:
                    continue
                ifans = False
                break
        if ifans:
            ans = [x, y, ch]
            break

print(' '.join([str(a) for a in ans]))

Fixed submission:
N = int(input())
P = [list(map(int, input().split())) for _ in range(N)]

for cx in range(101):
    for cy in range(101):
        H = -1
        ok = True
        for x, y, h in P:
            if h == 0:
                continue
            Hi = abs(x-cx) + abs(y-cy) + h
            if H == -1:
                H = Hi
                continue
            if Hi != H:
                ok = False
                break
        if not ok:
            continue
        for x, y, h in P:
            if h != max(H-abs(cx-x)-abs(cy-y), 0):
                ok = False
        if ok:
            print(cx, cy, H)
            break
    if ok:
        break

Buggy python submission (verdict: Runtime Error):
N = int(input())
xyh = [list(map(int, input().split())) for _ in range(N)]

ans = []
c = 0
for x in range(101):
    for y in range(101):
        for i, d in enumerate(xyh):
            if d[2] == 0:
                continue
            ch = abs(d[0] - x) + abs(d[1] - y) + d[2]
            if i == 0:
                chpre = ch
            if chpre != ch:
                break
        if chpre == ch:
            ans = [x, y, ch]
            break
    if ans:
        break

print(' '.join([str(a) for a in ans]))

Fixed submission:
N = int(input())
P = [list(map(int, input().split())) for _ in range(N)]

for cx in range(101):
    for cy in range(101):
        H = -1
        ok = True
        for x, y, h in P:
            if h == 0:
                continue
            Hi = abs(x-cx) + abs(y-cy) + h
            if H == -1:
                H = Hi
                continue
            if Hi != H:
                ok = False
                break
        if not ok:
            continue
        for x, y, h in P:
            if h != max(H-abs(cx-x)-abs(cy-y), 0):
                ok = False
        if ok:
            print(cx, cy, H)
            break
    if ok:
        break

Buggy python submission (verdict: Time Limit Exceeded):
from operator import itemgetter

N = int(input())
xyh = [list(map(int, input().split())) for _ in range(N)]
checked = [[False for _ in range(101)] for _ in range(101)]

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

q = [xyh[0]]
ans = []
while not ans:
    qq = []
    for s in q:
        x = s[0]
        y = s[1]
        for i, d in enumerate(xyh):
            if d[2] == 0:
                continue
            ch = abs(d[0] - x) + abs(d[1] - y) + d[2]
            if i == 0:
                chpre = ch
            if chpre != ch:
                break
        if chpre == ch:
            ans = [x, y, ch]
            break
        checked[x][y] = True
        nexts = [[x+1, y], [x-1, y], [x, y+1], [x, y-1]]
        for ne in nexts:
            nx = ne[0]
            ny = ne[1]
            if 0 <= nx <= 100 and 0 <= ny <= 100:
                if not checked[nx][ny]:
                    qq.append(ne)
    q = qq


print(' '.join([str(a) for a in ans]))
        
        



Fixed submission:
N = int(input())
P = [list(map(int, input().split())) for _ in range(N)]

for cx in range(101):
    for cy in range(101):
        H = -1
        ok = True
        for x, y, h in P:
            if h == 0:
                continue
            Hi = abs(x-cx) + abs(y-cy) + h
            if H == -1:
                H = Hi
                continue
            if Hi != H:
                ok = False
                break
        if not ok:
            continue
        for x, y, h in P:
            if h != max(H-abs(cx-x)-abs(cy-y), 0):
                ok = False
        if ok:
            print(cx, cy, H)
            break
    if ok:
        break

Buggy python submission (verdict: Time Limit Exceeded):
from operator import itemgetter

N = int(input())
xyh = [list(map(int, input().split())) for _ in range(N)]
checked = [[False for _ in range(101)] for _ in range(101)]

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

q = [xyh[0]]
ans = []
while not ans:
    qq = []
    for s in q:
        x = s[0]
        y = s[1]
        for i, d in enumerate(xyh):
            if d[2] == 0:
                continue
            ch = abs(d[0] - x) + abs(d[1] - y) + d[2]
            if i == 0:
                chpre = ch
            if chpre != ch:
                break
        if chpre == ch:
            ans = [x, y, ch]
            break
        checked[x][y] = True
        nexts = [[x+1, y], [x-1, y], [x, y+1], [x, y-1]]
        for ne in nexts:
            nx = ne[0]
            ny = ne[1]
            if 0 <= nx <= 100 and 0 <= ny <= 100:
                if not checked[nx][ny]:
                    qq.append(ne)
    q = qq


print(' '.join([str(a) for a in ans]))
        
        



Fixed submission:
N = int(input())
P = [list(map(int, input().split())) for _ in range(N)]

for cx in range(101):
    for cy in range(101):
        H = -1
        ok = True
        for x, y, h in P:
            if h == 0:
                continue
            Hi = abs(x-cx) + abs(y-cy) + h
            if H == -1:
                H = Hi
                continue
            if Hi != H:
                ok = False
                break
        if not ok:
            continue
        for x, y, h in P:
            if h != max(H-abs(cx-x)-abs(cy-y), 0):
                ok = False
        if ok:
            print(cx, cy, H)
            break
    if ok:
        break