Buggy python submission (verdict: Runtime Error):
N = int(input())
ls = []
for i in range(N):
  x,y,h = map(int, input().split())
  ls += [(x,y,h)]
ls.sort(key=lambda x:x[2])
px, py, ph = ls[-1]

ans = []
for i in range(101):
  for j in range(101):
    H = ph+abs(px-i)+abs(py-j)
    for l in ls:
      x, y, h = l
      u = max(H - abs(x-i) - abs(y-j), 0)
      if not u==h:
        break
    else:
      ans = (i,j,H)
      flag = True
      break
  if flag:
    break
print(*ans)

Fixed submission:
N = int(input())
ls = []
for i in range(N):
  x,y,h = map(int, input().split())
  ls += [(x,y,h)]
ls.sort(key=lambda x:x[2])
px, py, ph = ls[-1]

ans = []
flag = False
for i in range(101):
  for j in range(101):
    H = ph+abs(px-i)+abs(py-j)
    for l in ls:
      x, y, h = l
      u = max(H - abs(x-i) - abs(y-j), 0)
      if not u==h:
        break
    else:
      ans = (i,j,H)
      flag = True
      break
  if flag:
    break
print(*ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
ls = []
for i in range(N):
  x,y,h = map(int, input().split())
  ls += [(h,x,y)]
ls.sort(key=lambda x:x[2])
px, py, ph = ls[-1]

ans = []
for i in range(101):
  for j in range(101):
    pH = ph+abs(px-i)+abs(py-j)
    for l in ls:
      h, x, y = l
      u = max(pH - abs(x-i) - abs(y-j), 0)
      if not u==h:
        break
    else:
      ans = (i,j,pH)
      flag = True
      break
  if flag:
    break
print(*ans)

Fixed submission:
N = int(input())
ls = []
for i in range(N):
  x,y,h = map(int, input().split())
  ls += [(x,y,h)]
ls.sort(key=lambda x:x[2])
px, py, ph = ls[-1]

ans = []
flag = False
for i in range(101):
  for j in range(101):
    H = ph+abs(px-i)+abs(py-j)
    for l in ls:
      x, y, h = l
      u = max(H - abs(x-i) - abs(y-j), 0)
      if not u==h:
        break
    else:
      ans = (i,j,H)
      flag = True
      break
  if flag:
    break
print(*ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
ls = []
for i in range(N):
  x,y,h = map(int, input().split())
  ls += [(h,x,y)]
ls.sort(key=lambda x:x[2])
px, py, ph = ls[-1]

ans = []
for i in range(101):
  for j in range(101):
    pH = ph+abs(px-i)+abs(py-j)
    for l in ls:
      h, x, y = l
      u = pmax(H - abs(x-i) - abs(y-j), 0)
      if not u==h:
        break
    else:
      ans = (i,j,pH)
      break
  if ans:
    break
print(*ans)

Fixed submission:
N = int(input())
ls = []
for i in range(N):
  x,y,h = map(int, input().split())
  ls += [(x,y,h)]
ls.sort(key=lambda x:x[2])
px, py, ph = ls[-1]

ans = []
flag = False
for i in range(101):
  for j in range(101):
    H = ph+abs(px-i)+abs(py-j)
    for l in ls:
      x, y, h = l
      u = max(H - abs(x-i) - abs(y-j), 0)
      if not u==h:
        break
    else:
      ans = (i,j,H)
      flag = True
      break
  if flag:
    break
print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
ls = []
for i in range(N):
  x,y,h = map(int, input().split())
  ls += [(h,x,y)]


ans = []
for i in range(101):
  for j in range(101):
    ans += [(i,j)]
log = []
for a in ans:
  i, j = a
  pH = -1
  for l in ls:
    h, x, y = l
    if h>0:
      H = h+abs(x-i)+abs(y-j)
      if pH==-1:
        pH = H
      elif not H==pH:
        break
  else:
    x, y = a
    log += [(x,y,H)]
if len(log)>1:
  while True:
    u = 1
print(*log[0])

Fixed submission:
N = int(input())
ls = []
for i in range(N):
  x,y,h = map(int, input().split())
  ls += [(x,y,h)]
ls.sort(key=lambda x:x[2])
px, py, ph = ls[-1]

ans = []
flag = False
for i in range(101):
  for j in range(101):
    H = ph+abs(px-i)+abs(py-j)
    for l in ls:
      x, y, h = l
      u = max(H - abs(x-i) - abs(y-j), 0)
      if not u==h:
        break
    else:
      ans = (i,j,H)
      flag = True
      break
  if flag:
    break
print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
ls = []
for i in range(N):
  x,y,h = map(int, input().split())
  ls += [(h,x,y)]


ans = []
for i in range(101):
  for j in range(101):
    ans += [(i,j)]
log = []
for a in ans:
  i, j = a
  pH = -1
  for l in ls:
    h, x, y = l
    if h>0:
      H = h+abs(x-i)+abs(y-j)
      if pH==-1:
        pH = H
      elif not H==pH:
        break
  else:
    x, y = a
while True:
  u = 1
print(x,y,H)

Fixed submission:
N = int(input())
ls = []
for i in range(N):
  x,y,h = map(int, input().split())
  ls += [(x,y,h)]
ls.sort(key=lambda x:x[2])
px, py, ph = ls[-1]

ans = []
flag = False
for i in range(101):
  for j in range(101):
    H = ph+abs(px-i)+abs(py-j)
    for l in ls:
      x, y, h = l
      u = max(H - abs(x-i) - abs(y-j), 0)
      if not u==h:
        break
    else:
      ans = (i,j,H)
      flag = True
      break
  if flag:
    break
print(*ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
ls = []
for i in range(N):
  x,y,h = map(int, input().split())
  ls += [(h,x,y)]


ans = []
for i in range(101):
  for j in range(101):
    ans += [(i,j)]

H = 0
pH = -1
ansh = 0
log = []
na = []
for a in ans:
  i, j = a
  pH = -1
  for l in ls:
    h, x, y = l
    if h>0:
      H = h+abs(x-i)+abs(y-j)
      if pH==-1:
        pH = H
      elif not H==pH:
        break
    else:
      log += [a]
  else:
    na += [(a,H)]
ans = 0
for a in na:
  i,j = a[0]
  H = a[1]
  for l in log:
    h,x,y = l
    h = H-abs(x-i)-abs(y-j)
    if max(h,0)>0:
      break
  else:
    ans = a
    break
x, y = ans
print(x, y, H)

Fixed submission:
N = int(input())
ls = []
for i in range(N):
  x,y,h = map(int, input().split())
  ls += [(x,y,h)]
ls.sort(key=lambda x:x[2])
px, py, ph = ls[-1]

ans = []
flag = False
for i in range(101):
  for j in range(101):
    H = ph+abs(px-i)+abs(py-j)
    for l in ls:
      x, y, h = l
      u = max(H - abs(x-i) - abs(y-j), 0)
      if not u==h:
        break
    else:
      ans = (i,j,H)
      flag = True
      break
  if flag:
    break
print(*ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
ls = []
for i in range(N):
  x,y,h = map(int, input().split())
  ls += [(h,x,y)]


ans = []
for i in range(101):
  for j in range(101):
    ans += [(i,j)]

H = 0
pH = -1
ansh = 0
log = []
na = []
for a in ans:
  i, j = a
  pH = -1
  for l in ls:
    h, x, y = l
    if h>0:
      H = h+abs(x-i)+abs(y-j)
      if pH==-1:
        pH = H
      elif not H==pH:
        break
    else:
      log += [a]
  else:
    na += [a]
ans = 0
for a in na:
  i,j = a
  for l in log:
    h,x,y = l
    h = H-abs(x-i)-abs(y-j)
    if max(h,0)>0:
      break
  else:
    break
x, y = a
print(x, y, H)

Fixed submission:
N = int(input())
ls = []
for i in range(N):
  x,y,h = map(int, input().split())
  ls += [(x,y,h)]
ls.sort(key=lambda x:x[2])
px, py, ph = ls[-1]

ans = []
flag = False
for i in range(101):
  for j in range(101):
    H = ph+abs(px-i)+abs(py-j)
    for l in ls:
      x, y, h = l
      u = max(H - abs(x-i) - abs(y-j), 0)
      if not u==h:
        break
    else:
      ans = (i,j,H)
      flag = True
      break
  if flag:
    break
print(*ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
ls = []
for i in range(N):
  x,y,h = map(int, input().split())
  ls += [(h,x,y)]
  
L = sorted(ls, key=lambda x:x[0], reverse=True)

Cx1 = 101
Cy1 = 101
Cx2 = -1
Cy2 = -1
Chx1 = 0
Chy1 = 0
Chx2 = 0
Chy2 = 0
for l in L:
  h, x, y = l
  if Chx1<=h and Cx1>x:
    Cx1 = x
    Chx1 = h
  if Chx2<=h and Cx2<x:
    Cx2 = x
    Chx2 = h
  if Chy1<=h and Cy1>y:
    Cy1 = y
    Chy1 = h
  if Chy2<=h and Cy2<y:
    Cy2 = y
    Chy2 = h
  #print(Cx1, Cx2, Cy1, Cy2)

ans = []
for i in range(Cx1, Cx2+1):
  for j in range(Cy1, Cy2+1):
    ans += [(i,j)]

H = 0
pH = -1
ansh = 0
while len(ans)>1:
  na = []
  for a in ans:
    i, j = a
    pH = -1
    for l in L:
      h, x, y = l
      #print(l, a)
      if h>0:
        H = h+abs(x-i)+abs(y-j)
#        print(pH, H, l)
        if pH==-1:
          pH = H
        elif not H==pH:
          break
    else:
      na += [a]
      ansh = H
  ans = na
if pH == -1:
  for l in L:
    h, x, y =l
    if h>0:
      break
  ansh = h + abs(x-ans[0][0]) + abs(y-ans[0][1])
print(*ans[0], ansh)

Fixed submission:
N = int(input())
ls = []
for i in range(N):
  x,y,h = map(int, input().split())
  ls += [(x,y,h)]
ls.sort(key=lambda x:x[2])
px, py, ph = ls[-1]

ans = []
flag = False
for i in range(101):
  for j in range(101):
    H = ph+abs(px-i)+abs(py-j)
    for l in ls:
      x, y, h = l
      u = max(H - abs(x-i) - abs(y-j), 0)
      if not u==h:
        break
    else:
      ans = (i,j,H)
      flag = True
      break
  if flag:
    break
print(*ans)