Problem:


Score: 300 points

Problem Statement

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 1

4
2 3 5
2 1 5
1 2 5
3 2 5

Sample Output 1

2 2 6

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

Sample Input 2

2
0 0 100
1 1 98

Sample Output 2

0 0 100

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

Note that C_X and C_Y are known to be integers between 0 and 100.

Sample Input 3

3
99 1 191
100 1 192
99 0 192

Sample Output 3

100 0 193

In this case, the center coordinates and the height can be identified as (100, 0) and 193.  



Sample input:
4
2 3 5
2 1 5
1 2 5
3 2 5


Sample output:
2 2 6

Submission status: Wrong Answer

Solution code:
N = int(input())
alist = []


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

for i in range(0, 101):
        # print("i = " + str(i))
        for j in range(0, 101):
                # print("j = " + str(j))
                state = 1
                H_before = None
                for s in alist:
                    # print("s = " + str(s))
                    H = int(s[2]) + abs(int(s[0])-j) + abs(int(s[1])-i)
                    # print("H = " + str(H))
                    if H < 1:
                        continue
                    
                    elif  H_before == None or H == H_before:
                        state = 0
                        H_before = H
                    
                    else:
                        state = 1
                        break
                
                if state == 0:
                    print("{} {} {}".format(j, i, H))

Submission status: Wrong Answer

Solution code:
N = int(input())
alist = []


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

xmin = min(alist, key= lambda x: x[0])
ymin = min(alist, key= lambda x: x[1])

xmax = max(alist, key= lambda x: x[0])
ymax = max(alist, key= lambda x: x[1])
# print(xmin)


for i in range(0, 101):
    if i < 0 or 100 < i:
        continue

    else:
        # print("i = " + str(i))
        for j in range(0, 101):
            if j < 0 or 100 < j:
                continue
            
            else:
                # print("j = " + str(j))
                state = 1
                H_before = None
                for s in alist:
                    # print("s = " + str(s))
                    H = int(s[2]) + abs(int(s[0])-j) + abs(int(s[1])-i)
                    # print("H = " + str(H))
                    if H < 0:
                        continue
                    
                    if  H_before == None or H == H_before:
                        state = 0
                        H_before = H
                    
                    else:
                        state = 1
                        break
                
                if state == 0:
                    print("{} {} {}".format(j, i, H))

Submission status: Wrong Answer

Solution code:
N = int(input())
alist = []


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

xmin = min(alist, key= lambda x: x[0])
ymin = min(alist, key= lambda x: x[1])

xmax = max(alist, key= lambda x: x[0])
ymax = max(alist, key= lambda x: x[1])
# print(xmin)


for i in range(int(ymin[1])-1, int(ymax[1])+2):
    if i < 0 or 100 < i:
        continue

    else:
        # print("i = " + str(i))
        for j in range(int(xmin[0])-1, int(xmax[0])+2):
            if j < 0 or 100 < j:
                continue
            
            else:
                # print("j = " + str(j))
                state = 1
                H_before = None
                for s in alist:
                    # print("s = " + str(s))
                    H = int(s[2]) + abs(int(s[0])-j) + abs(int(s[1])-i)
                    # print("H = " + str(H))
                    if H < 0:
                        continue
                    
                    if  H_before == None or H == H_before:
                        state = 0
                        H_before = H
                    
                    else:
                        state = 1
                        break
                
                if state == 0:
                    print("{} {} {}".format(j, i, H))

Submission status: Wrong Answer

Solution code:
N = int(input())
alist = []


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

xmin = min(alist, key= lambda x: x[0])
ymin = min(alist, key= lambda x: x[1])

xmax = max(alist, key= lambda x: x[0])
ymax = max(alist, key= lambda x: x[1])
# print(xmin)


for i in range(int(ymin[1])-1, int(ymax[1])+2):
    if i < 0 or 100 < i:
        continue

    else:
        # print("i = " + str(i))
        for j in range(int(xmin[0])-1, int(xmax[0])+2):
            if j < 0 or 100 < j:
                continue
            
            else:
                # print("j = " + str(j))
                state = 1
                H_before = None
                for s in alist:
                    # print("s = " + str(s))
                    H = int(s[2]) + abs(int(s[0])-j) + abs(int(s[1])-i)
                    # print("H = " + str(H))
                    if H < 0:
                        H = 0
                    
                    if  H_before == None or H == H_before:
                        state = 0
                        H_before = H
                    
                    else:
                        state = 1
                        break
                
                if state == 0:
                    print("{} {} {}".format(j, i, H))

Submission status: Wrong Answer

Solution code:
N = int(input())
alist = []


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

xmin = min(alist, key= lambda x: x[0])
ymin = min(alist, key= lambda x: x[1])

xmax = max(alist, key= lambda x: x[0])
ymax = max(alist, key= lambda x: x[1])
# print(xmin)


for i in range(int(ymin[1])-1, int(ymax[1])+2):
    if i < 0 or 100 < i:
        continue

    else:
        # print("i = " + str(i))
        for j in range(int(xmin[0])-1, int(xmax[0])+2):
            if j < 0 or 100 < j:
                continue
            
            else:
                # print("j = " + str(j))
                state = 1
                H_before = None
                for s in alist:
                    # print("s = " + str(s))
                    H = int(s[2]) + abs(int(s[0])-j) + abs(int(s[1])-i)
                    # print("H = " + str(H))
                    
                    if  H_before == None or H == H_before:
                        state = 0
                        H_before = H
                    
                    else:
                        state = 1
                        break
                
                if state == 0:
                    print("{} {} {}".format(j, i, H))

Submission status: Wrong Answer

Solution code:
import numpy as np
import itertools
import sys

N = int(input())
xyh = [list(map(int,input().split())) for i in range(N)]
sorce = np.array(range(101))

for ar in itertools.product(sorce,repeat=2):
    H = 0
    cnt = 0
    f = 0
    for i in xyh:
        X,Y = np.subtract( [ar[0],ar[1]] , [i[0],i[1]] )
        if i[2] == 0:
            cnt += 1
        elif f == 0:
            H = abs(X)+abs(Y)+i[2]
            f = 1
            cnt += 1
        elif f == 1 and H == (abs(X)+abs(Y)+i[2]):
            cnt += 1
        else:
            break
        if cnt == N:
            print(ar[0],ar[1],H)
            sys.exit()

Submission status: Wrong Answer

Solution code:
import numpy as np
import itertools
import sys

N = int(input())
xyh = [list(map(int,input().split())) for i in range(N)]
sorce = np.array(range(101))

for ar in itertools.product(sorce,repeat=2):
    H = 0
    cnt = 0
    f = 0
    for i in xyh:
        X,Y = np.subtract( [ar[0],ar[1]] , [i[0],i[1]] )
        if i[2] == 0:
            cnt += 1
        elif f == 0:
            H = abs(X)+abs(Y)+i[2]
            f = 1
            cnt += 1
        elif f == 1 and i[2] == (H-(abs(X)+abs(Y))):
            cnt += 1
        else:
            break
        if cnt == N:
            print(ar[0],ar[1],H)
            sys.exit()

Submission status: Wrong Answer

Solution code:
import numpy as np
import itertools
import sys

N = int(input())
xyh = [list(map(int,input().split())) for i in range(N)]
sorce = np.array(range(101))

for ar in itertools.product(sorce,repeat=2):
    H = 0
    f = 0
    cnt = 0
    for i in xyh:
        X,Y = np.subtract( [ar[0],ar[1]] , [i[0],i[1]] )
        if f == 0:
            H = max(H,abs(X)+abs(Y)+i[2])
            f = 1
        else:
            if i[2] == max(H-(abs(X)+abs(Y)),0):
                cnt += 1
                if cnt == N-1:
                    print(ar[0],ar[1],H)
                    sys.exit()
            else:
                break

Submission status: Wrong Answer

Solution code:
import numpy as np
import itertools
import sys

N = int(input())
xyh = [list(map(int,input().split())) for i in range(N)]
sorce = np.array(range(101))
f = 0
cnt = 0

for ar in itertools.product(sorce,repeat=2):
    f = 0
    cnt = 0
    for i in xyh:
        X,Y = abs(np.subtract( [ar[0],ar[1]] , [i[0],i[1]] ))
        if f == 0:
            H = X+Y+i[2]
            f = 1
        else:
            if H == X+Y+i[2]:
                cnt += 1
                if cnt == N-1:
                    print(ar[0],ar[1],H)
                    sys.exit()
            else:
                break

Submission status: Wrong Answer

Solution code:
#!/mnt/c/Users/moiki/bash/env/bin/python
N = int(input())
hlist = []
for i in range(N):
    x,y,h = list(map(int, input().split()))
    hlist.append((x,y,h))

for i in range(101):
    for j in range(101):
        cx = i
        cy = j
        plist = [x for x in hlist if x[2] > 0]
        plist = sorted(plist, key=lambda x: x[2])
        if len(plist) == 0:
            continue

        for hpp in plist:
            hm = hpp[2] + abs(hpp[0]-cx) + abs(hpp[1]-cy)
            if hm < 1:
                continue
            ok = True
            for l in plist:
                if l[2] != max((hm - abs(l[0] - cx) - abs(l[1] - cy)), 0):
                    ok = False
                    break
            if ok:
                print("{0} {1} {2}".format(cx, cy, hm))
                exit(0)

Submission status: Wrong Answer

Solution code:
#!/mnt/c/Users/moiki/bash/env/bin/python
N = int(input())
hlist = []
for i in range(N):
    x,y,h = list(map(int, input().split()))
    hlist.append((x,y,h))

for i in range(101):
    for j in range(101):
        cx = i
        cy = j
        plist = [x for x in hlist if x[2] > 0]
        plist = sorted(plist, key=lambda x: x[2])
        if len(plist) == 0:
            continue

        hm = plist[0][2] + abs(plist[0][0]-cx) + abs(plist[0][1]-cy)
        if hm < 1:
            continue
        ok = True
        for l in plist:
            if l[2] != max((hm - abs(l[0] - cx) - abs(l[1] - cy)), 0):
                ok = False
                break
        if ok:
            print("{0} {1} {2}".format(cx, cy, hm))
            exit(0)

Submission status: Wrong Answer

Solution code:
#!/mnt/c/Users/moiki/bash/env/bin/python
N = int(input())
hlist = []
for i in range(N):
    x,y,h = list(map(int, input().split()))
    hlist.append((x,y,h))

for i in range(101):
    for j in range(101):
        cx = i
        cy = j
        plist = [x for x in hlist if x[2] > 0]
        plist = sorted(plist, key=lambda x: x[2])
        if len(plist) == 0:
            continue

        hm = plist[0][2] + abs(plist[0][0]-cx) + abs(plist[0][1]-cy)
        ok = True
        for l in plist:
            if l[2] != max((hm - abs(l[0] - cx) - abs(l[1] - cy)), 0):
                ok = False
                break
        if ok:
            print("{0} {1} {2}".format(cx, cy, hm))
            exit(0)

Submission status: Wrong Answer

Solution code:
#!/mnt/c/Users/moiki/bash/env/bin/python
N = int(input())
hlist = []
for i in range(N):
    x,y,h = list(map(int, input().split()))
    hlist.append((x,y,h))

for i in range(101):
    for j in range(101):
        cx = i
        cy = j
        plist = [x for x in hlist if x[2] > 0]
        plist = sorted(plist, key=lambda x: x[2])
        if len(plist) == 0:
            continue
        plist.reverse()

        hm = plist[0][2] + abs(plist[0][0]-cx) + abs(plist[0][1]-cy)
        ok = True
        for l in plist:
            if l[2] != max((hm - abs(l[0] - cx) - abs(l[1] - cy)), 0):
                ok = False
                break
        if ok:
            print("{0} {1} {2}".format(cx, cy, hm))
            exit(0)

Submission status: Wrong Answer

Solution code:
n = int(input())
points = []

for i in range(n):
    x, y, h = map(int, input().split())
    points.append((h, x, y))
    
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)

Submission status: Wrong Answer

Solution code:
n = int(input())
hxy = []

for i in range(n):
    x, y, h = map(int, input().split())
    hxy.append([h, x, y])
    
for i in range(101):
    for j in range(101):
        count = 0
        for h, x, y in hxy:
            h0, x0, y0 = hxy[0]
            H = h0 + abs(x0 - i) + abs(y0 - j)
            if h == max(H - abs(x - i) - abs(y - j), 0):
                count += 1
            if count == n:
                print(i, j, H)

Submission status: Wrong Answer

Solution code:
N = int(input())
query = [list(map(int, input().split())) for _ in range(N)]


def isvalid(i, j):
    p, q, h = query[0]
    H = h + abs(p - i) + abs(q - j)
    if h == 0 or H < 1:
        return -1
    for p, q, h in query[1:]:
        if h != max(H - abs(p - i) - abs(q - j), 0):
            return -1
    return H


for i in range(101):
    for j in range(101):
        H = isvalid(i, j)
        if H >= 1:
            print(i, j, H)
            exit()

Submission status: Wrong Answer

Solution code:
N = int(input())
query = [list(map(int, input().split())) for _ in range(N)]


def isvalid(i, j):
    p, q, h = query[0]
    H = h + abs(p - i) + abs(q - j)
    if h == 0 or H < 1:
        return -1
    for p, q, h in query[1:]:
        if h == 0:
            continue
        if h != max(H - abs(p - i) - abs(q - j), 0):
            return -1
    return H


for i in range(101):
    for j in range(101):
        H = isvalid(i, j)
        if H != -1:
            print(i, j, H)
            exit()

Submission status: Wrong Answer

Solution code:
N = int(input())
query = [list(map(int, input().split())) for _ in range(N)]


def isvalid(i, j):
    p, q, h = query[0]
    H = h + abs(p - i) + abs(q - j)
    if h == 0 or H < 1:
        return -1
    for que in query[1:]:
        p, q, h = que
        if h != max(H - abs(p - i) - abs(q - j), 0):
            return -1
    return H


for i in range(101):
    for j in range(101):
        H = isvalid(i, j)
        if H != -1:
            print(i, j, H)
            exit()

Submission status: Wrong Answer

Solution code:
N = int(input())
query = [list(map(int, input().split())) for _ in range(N)]


def isvalid(i, j):
    p, q, h = query[0]
    H = h + abs(p - i) + abs(q - j)
    if H == 0 or H < 1:
        return -1
    for que in query[1:]:
        p, q, h = que
        if h != max(H - abs(p - i) - abs(q - j), 0):
            return -1
    return H


for i in range(101):
    for j in range(101):
        H = isvalid(i, j)
        if H != -1:
            print(i, j, H)
            exit()

Submission status: Wrong Answer

Solution code:
N = int(input())
query = [list(map(int, input().split())) for _ in range(N)]


def isvalid(i, j):
    p, q, h = query[0]
    H = h + abs(p - i) + abs(q - j)
    if H < 1:
        return -1
    for que in query[1:]:
        p, q, h = que
        if h != max(H - abs(p - i) - abs(q - j), 0):
            return -1
    return H


for i in range(101):
    for j in range(101):
        H = isvalid(i, j)
        if H != -1:
            print(i, j, H)
            exit()

Submission status: Wrong Answer

Solution code:
N = int(input())
query = [list(map(int, input().split())) for _ in range(N)]


def isvalid(i, j):
    p, q, h = query[0]
    H = h + abs(p - i) + abs(q - j)
    if H < 1:
        return -1
    for que in query[1:]:
        p, q, h = que
        if H != h + abs(p - i) + abs(q - j):
            return -1
    return H


for i in range(101):
    for j in range(101):
        H = isvalid(i, j)
        if H != -1:
            print(i, j, H)
            exit()

Submission status: Wrong Answer

Solution code:
N = int(input())
query = [list(map(int, input().split())) for _ in range(N)]


def isvalid(i, j):
    p, q, h = query[0]
    H = h + abs(p - i) + abs(q - j)
    if H < 1:
        return -1
    for que in query[1:]:
        p, q, h = que
        if H != h + abs(p - i) + abs(q - j):
            return -1
    return H


for i in range(101):
    for j in range(101):
        H = isvalid(i, j)
        if H != -1:
            print(i, j, H)

Submission status: Wrong Answer

Solution code:
#!/mnt/c/Users/moiki/bash/env/bin/python
N = int(input())
hlist = []
for i in range(N):
    x,y,h = list(map(int, input().split()))
    hlist.append((x,y,h))

for i in range(101):
    for j in range(101):
        cx = i
        cy = j
        hm = hlist[0][2] + abs(hlist[0][0]-cx) + abs(hlist[0][1]-cy)
        ok = True
        for l in hlist:
            if l[2] != max((hm - abs(l[0] - cx) - abs(l[1] - cy)), 0):
                ok = False
                break
        if ok:
            print("{0} {1} {2}".format(cx, cy, hm))

Submission status: Wrong Answer

Solution code:
#!/mnt/c/Users/moiki/bash/env/bin/python
N = int(input())
hlist = []
for i in range(N):
    x,y,h = list(map(int, input().split()))
    hlist.append((x,y,h))

for i in range(101):
    for j in range(101):
        cx = i
        cy = j
        hm = hlist[0][2] + abs(hlist[0][0]-cx) + abs(hlist[0][1]-cy)
        ok = True
        for l in hlist:
            if l[2] != hm - abs(l[0] - cx) - abs(l[1] - cy):
                ok = False
                break
        if ok:
            print("{0} {1} {2}".format(cx, cy, hm))

# print("end")
        

# cx = 10
# cy = 10
# for i in range(20):
#     for j in range(20):
#         print("{0:3d}".format(max(100-abs(i-cy)-abs(j-cx), 0)), end=" ")
#     print("")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

array = []

for i in range(N):
    array.append(list(map(int,input().split())))

test = []

t = []

for x in range(101):
    for y in range(101):
        H = []
        for i in array:
            if i[2] > 0:
                H_i = max(abs(i[0]-x)+abs(i[1]-y)+i[2],0)
                H.append(H_i)
        Hset = set(H)
        H = list(Hset)[0]
        if(len(Hset)==1 and H>=0):
            t.append([x,y,H])

if len(t) >=2:
    for x in range(101):
        for y in range(101):
            H = []
            for i in array:
                if True:
                    H_i = max(abs(i[0]-x)+abs(i[1]-y)+i[2],0)
                    H.append(H_i)
            Hset = set(H)
            H = list(Hset)[0]
            if(len(Hset)==1 and H>=0):
                t.append([x,y,H])
            
print("{0[0]} {0[1]} {0[2]}".format(t[0]))

Submission status: Wrong Answer

Solution code:
N = int(input())

array = []

for i in range(N):
    array.append(list(map(int,input().split())))

test = []

t = None

for x in range(101):
    for y in range(101):
        H=[]
        for i in array:
            if i[2] > 0:
                H_i = max(abs(i[0]-x)+abs(i[1]-y)+i[2],0)
                H.append(H_i)
        Hset = set(H)
        H = list(Hset)[0]
        if(len(Hset)==1 and H>=0):
            t = (x,y,H)
            
if t is None:
    x = 150/0

print("{0[0]} {0[1]} {0[2]}".format(t))

Submission status: Wrong Answer

Solution code:
N = int(input())

array = []

for i in range(N):
    array.append(list(map(int,input().split())))

test = []

t = None

for x in range(101):
    for y in range(101):
        H=[]
        for i in array:
            if i[2] > 0:
                H_i = max(abs(i[0]-x)+abs(i[1]-y)+i[2],0)
                H.append(H_i)
        Hset = set(H)
        H = list(Hset)[0]
        if(len(Hset)==1 and H>=0):
            t = (x,y,H)

if t is None:
    for x in range(101):
        for y in range(101):
            H=[]
            for i in array:
                if True:
                    H_i = max(abs(i[0]-x)+abs(i[1]-y)+i[2],0)
                    H.append(H_i)
            Hset = set(H)
            H = list(Hset)[0]
            if(len(Hset)==1 and H>=0):
                t = (x,y,H)

print("{0[0]} {0[1]} {0[2]}".format(t))

Submission status: Wrong Answer

Solution code:
N = int(input())

array = []

for i in range(N):
    array.append(list(map(int,input().split())))

test = []

for x in range(101):
    for y in range(101):
        H=[]
        for i in array:
            if i[2] > 0:
                H_i = max(abs(i[0]-x)+abs(i[1]-y)+i[2],0)
                H.append(H_i)
        Hset = set(H)
        H = list(Hset)[0]
        if(len(Hset)==1 and H>=0):
            t = (x,y,H)

if t is None:
    for x in range(101):
        for y in range(101):
            H=[]
            for i in array:
                if True:
                    H_i = max(abs(i[0]-x)+abs(i[1]-y)+i[2],0)
                    H.append(H_i)
            Hset = set(H)
            H = list(Hset)[0]
            if(len(Hset)==1 and H>=0):
                t = (x,y,H)

print("{0[0]} {0[1]} {0[2]}".format(t))

Submission status: Wrong Answer

Solution code:
N = int(input())

array = []

for i in range(N):
    array.append(list(map(int,input().split())))

test = []

for x in range(101):
    for y in range(101):
        H=[]
        for i in array:
            if abs(i[0]-x)+abs(i[1]-y)+i[2] >= 0:
                H_i = max(abs(i[0]-x)+abs(i[1]-y)+i[2],0)
                H.append(H_i)
        Hset = set(H)
        H = list(Hset)[0]
        if(len(Hset)==1 and H>=0):
            print(x,y,H)

Submission status: Wrong Answer

Solution code:
N = int(input())

array = []

for i in range(N):
    array.append(list(map(int,input().split())))

test = []

for x in range(101):
    for y in range(101):
        H=[]
        for i in array:
            if i[2] >= 0:
                H_i = max(abs(i[0]-x)+abs(i[1]-y)+i[2],0)
                H.append(H_i)
        Hset = set(H)
        H = list(Hset)[0]
        if(len(Hset)==1 and H>=0):
            print(x,y,H)

Submission status: Wrong Answer

Solution code:
N = int(input())

array = []

for i in range(N):
    array.append(list(map(int,input().split())))

test = []

for x in range(101):
    for y in range(101):
        H=[]
        for i in array:
            if i[2] > 0:
                H_i = max(abs(i[0]-x)+abs(i[1]-y)+i[2],0)
                H.append(H_i)
        Hset = set(H)
        H = list(Hset)[0]
        if(len(Hset)==1 and H>=0):
            print(x,y,H)

Submission status: Wrong Answer

Solution code:
N = int(input())

array = []

for i in range(N):
    array.append(list(map(int,input().split())))

for x in range(101):
    for y in range(101):
        H=[]
        for i in array:
            H_i = max(abs(i[0]-x)+abs(i[1]-y)+i[2],0)
            H.append(H_i)
        Hset = set(H)
        H = list(Hset)[0]
        if(len(Hset)==1 and H>=0):
            print(x,y,H)

Submission status: Wrong Answer

Solution code:
N = int(input())

array = []

for i in range(N):
    array.append(list(map(int,input().split())))

for x in range(101):
    for y in range(101):
        H=[]
        for i in array:
            H_i = max(abs(i[0]-x)+abs(i[1]-y)+i[2],0)
            H.append(H_i)
        Hset = set(H)
        if(len(Hset)==1):
            print(x,y,list(Hset)[0])

Submission status: Wrong Answer

Solution code:
N = int(input())
X, Y, H = zip(*[tuple(map(int, input().split(" "))) for _ in range(N)])

for i in range(N):
	if H[i] <= 0:
		continue
	std = i
	break
# print(X[std], Y[std])
for cy in range(101):
	for cx in range(101):
		ch = H[std] + abs(cx-X[std]) + abs(cy-Y[std])
		flag = True
		for i in range(N):
			if max(0, ch - abs(cx-X[i]) - abs(cy-Y[i])) != H[i]:
				flag = False
				# break
			print(ch, cx, cy, X[i], Y[i], ch - abs(cx-X[i]) - abs(cy-Y[i]), H[i])
		if flag:
			print(cx, cy, ch)
			exit()

Submission status: Wrong Answer

Solution code:
N = int(input())
X, Y, H = zip(*[tuple(map(int, input().split(" "))) for _ in range(N)])

for i in range(N):
	if H[i] <= 0:
		continue
	std = i
	break
# print(X[std], Y[std])
for cy in range(101):
	for cx in range(101):
		ch = H[std] + abs(cx-X[std]) + abs(cy-Y[std])
		flag = True
		for i in range(N):
			if min(0, ch - abs(cx-X[i]) - abs(cy-Y[i])) != H[i]:
				flag = False
				# break
			print(ch, cx, cy, X[i], Y[i], ch - abs(cx-X[i]) - abs(cy-Y[i]), H[i])
		if flag:
			print(cx, cy, ch)
			exit()

Submission status: Wrong Answer

Solution code:
N = int(input())
X, Y, H = zip(*[tuple(map(int, input().split(" "))) for _ in range(N)])

for i in range(N):
	if H[i] == 0:
		continue
	std = i
	break

for cy in range(101):
	for cx in range(101):
		ch = H[std] + abs(X[std]-cx) + abs(Y[std]-cy)
		flag = True
		for i in range(N):
			if ch - abs(cx-X[i]) - abs(cy-Y[i]) != H[i]:
				flag = False
				break
		if flag:
			print(cx, cy, ch)
			exit()

Submission status: Wrong Answer

Solution code:
data = [map(int, raw_input().split()) for _ in range(input())]
 
for cx, cy in ((cx, cy) for cx in range(101) for cy in range(101)):
    s = set(abs(cx - x) + abs(cy - y) + h for x, y, h in data if h != 0)
    if len(s) == 1:
        ch = s.pop()
        if len(data) == 1:
            raise Exception
        print cx, cy, ch
        break

Submission status: Wrong Answer

Solution code:

data = [map(int, raw_input().split()) for _ in range(input())]
 
for cx, cy in ((cx, cy) for cx in range(101) for cy in range(101)):
    s = set(abs(cx - x) + abs(cy - y) + h for x, y, h in data if h != 0)
    if len(s) == 1:
        ch = s.pop()
        if ch == 2:
            raise Exception
        print cx, cy, ch
        break

Submission status: Wrong Answer

Solution code:
data = [map(int, raw_input().split()) for _ in range(input())]
 
for cx, cy in ((cx, cy) for cx in range(101) for cy in range(101)):
    s = set(abs(cx - x) + abs(cy - y) + h for x, y, h in data if h != 0)
    if len(s) == 1:
        ch = s.pop()
        if ch == 1:
            raise Exception
        print cx, cy, ch
        break

Submission status: Wrong Answer

Solution code:
data = [map(int, raw_input().split()) for _ in range(input())]
 
for cx, cy in ((cx, cy) for cx in range(101) for cy in range(101)):
    s = set(abs(cx - x) + abs(cy - y) + h for x, y, h in data if h != 0)
    if len(s) == 1:
        print cx, cy, s.pop()
        break
else:
    raise Exception

Submission status: Wrong Answer

Solution code:
data = [map(int, raw_input().split()) for _ in range(input())]

for cx, cy in ((cx, cy) for cx in range(101) for cy in range(101)):
    s = set(abs(cx - x) + abs(cy - y) + h for x, y, h in data if h != 0)
    if len(s) == 1:
        print cx, cy, s.pop()
        break

Submission status: Wrong Answer

Solution code:
data = [map(int, raw_input().split()) for _ in range(input())]

for cx, cy in ((cx, cy) for cx in range(101) for cy in range(101)):
    s = set(abs(cx - x) + abs(cy - y) + h for x, y, h in data)
    if len(s) == 1:
        print cx, cy, s.pop()
        break

Submission status: Wrong Answer

Solution code:
data = [map(int, raw_input().split()) for _ in range(input())]

for cx, cy in ((cx, cy) for cx in range(5) for cy in range(5)):
    s = set(abs(cx - x) + abs(cy - y) + h for x, y, h in data)
    if len(s) == 1:
        print cx, cy, s.pop()
        break

Submission status: Wrong Answer

Solution code:
n = int(input())

clues = [tuple(map(int, input().split())) 
         for _i in range(n)]
good_clue = next(clue for clue in clues if clue[2] > 0)

centers = [(x, y) 
           for x in range(101) 
           for y in range(101)]
for cx, cy in centers:
    ch = good_clue[2] \
         + abs(good_clue[0] - cx) \
         + abs(good_clue[1] - cy)

    if all(h != max(ch - abs(x - cx) - abs(y - cy), 0) 
           for x, y, h in clues):
        print(cx, cy, ch)
        break

Submission status: Wrong Answer

Solution code:
n = int(input())

clues = []
for i in range(n):
    clues.append(tuple(map(int, input().split())))

sam_x, sam_y, sam_h = next((x, y, h) for x, y, h in clues if h >= 0)

centers = [(x, y) for x in range(101) for y in range(101)]
for cx, cy in centers:
    ch = sam_h + abs(sam_x - cx) + abs(sam_y - cy)
    identified = True
    for x, y, h in clues:
        if h != max(ch - abs(x - cx) - abs(y - cy), 0):
            identified = False
            break
    if identified:
        print(cx, cy, ch)
        exit()