Buggy python submission (verdict: Runtime Error):
from sys import stdin
il = lambda func=int: list(map(func, stdin.readline().rstrip().split()))
ils = lambda n, s="int(input())": [eval(s) for _ in range(n)]

n = int(input())
l = []
for i in range(n):
    a, b, c = il()
    l.append([a, b, c])
cx, cy = 0, 0
x, y = 0, 0
hoge = []
for i in range(n):
    for j in range(n):
        if i == j: continue
        if l[i][2] == l[j][2]:
            if l[i][0] == l[j][0] or l[i][1] == l[j][1]:
                hoge.append([i, j])
                print((l[i][0] + l[j][0]) // 2, (l[i][1] + l[j][1]) // 2, l[1][2]+1)
                exit()
a, b = hoge[0]
if l[a][0] == l[b][0]:
    if l[a][1] + l[b][1] > 100:
        print(l[a][0], 100, l[a][2]+1)
    else:
        print(l[a][0], 0, l[a][2]+1)
else:
    if l[a][0] + l[b][0] > 100:
        print(100, l[a][1], l[a][2]+1)
    else:
        print(0, l[a][1], l[a][2]+1)


Fixed submission:
from sys import stdin
il = lambda func=int: list(map(func, stdin.readline().rstrip().split()))
ils = lambda n, s="int(input())": [eval(s) for _ in range(n)]

n = int(input())
l = ils(n, "il()")

for i in range(101):
    for j in range(101):
        zero = []
        height = -1
        ok = 1
        for k in range(n):
            if l[k][2] == 0:
                zero.append(k)
                continue
            if height == -1:
                height = abs(i-l[k][0]) + abs(j-l[k][1]) + l[k][2]
            if height != abs(i-l[k][0]) + abs(j-l[k][1]) + l[k][2]:
                ok = 0
                break
        for k in zero:
            if height == -1:
                height = abs(i-l[k][0]) + abs(j-l[k][1]) + l[k][2]
            if height > abs(i-l[k][0]) + abs(j-l[k][1]) + l[k][2]:
                ok = 0
                break
        if ok:
            print(i, j, height)

Buggy python submission (verdict: Runtime Error):
from sys import stdin
il = lambda func=int: list(map(func, stdin.readline().rstrip().split()))
ils = lambda n, s="int(input())": [eval(s) for _ in range(n)]

n = int(input())
l = []
grid = [[-1] * 100 for _ in range(100)]
for i in range(n):
    a, b, c = il()
    grid[a][b] = c
    l.append(list(a, b, c))
cx, cy = 0, 0
x, y = 0, 0
hoge = []
for i in range(n):
    for j in range(n):
        if i == j: continue
        if l[i][2] == l[j][2]:
            if l[i][0] == l[j][0] or l[i][1] == l[j][1]:
                hoge.append(list(i, j))
                print((l[i][0] + l[j][0]) // 2, (l[i][1] + l[j][1]) // 2, l[1][2]+1)
                exit()
a, b = hoge[0]
if l[a][0] == l[b][0]:
    if l[a][1] + l[b][1] > 100:
        print(l[a][0], 100, l[a][2]+1)
    else:
        print(l[a][0], 0, l[a][2]+1)
else:
    if l[a][0] + l[b][0] > 100:
        print(100, l[a][1], l[a][2]+1)
    else:
        print(0, l[a][1], l[a][2]+1)

Fixed submission:
from sys import stdin
il = lambda func=int: list(map(func, stdin.readline().rstrip().split()))
ils = lambda n, s="int(input())": [eval(s) for _ in range(n)]

n = int(input())
l = ils(n, "il()")

for i in range(101):
    for j in range(101):
        zero = []
        height = -1
        ok = 1
        for k in range(n):
            if l[k][2] == 0:
                zero.append(k)
                continue
            if height == -1:
                height = abs(i-l[k][0]) + abs(j-l[k][1]) + l[k][2]
            if height != abs(i-l[k][0]) + abs(j-l[k][1]) + l[k][2]:
                ok = 0
                break
        for k in zero:
            if height == -1:
                height = abs(i-l[k][0]) + abs(j-l[k][1]) + l[k][2]
            if height > abs(i-l[k][0]) + abs(j-l[k][1]) + l[k][2]:
                ok = 0
                break
        if ok:
            print(i, j, height)