Harryxun/stf_run huggingface dataset:
s = input()[::-1]
t = input()[::-1]
for i,c in enumerate(s):
  if c == t[0]:
    for j in range(len(t)):
      if t[j] != s[i+j] and s[i+j] != '?':
        break
    else:
      for j in range(len(t)):
        s[i+j] =  t[j]
print(s.replace('?', 'a'))

### FIXED CODE ###

s = input()[::-1]
t = input()[::-1]
for i,c in enumerate(s):
  if (c == t[0] or c == '?') and (i+len(t) < len(s)+1):
    for j in range(len(t)):
      if t[j] != s[i+j] and s[i+j] != '?':
        break
    else:
      str_list = list(s)
      for j in range(len(t)):
        str_list[i+j] =  t[j]
      s = ''.join(str_list)
      print(s.replace('?', 'a')[::-1])
      break
else:
  print('UNRESTORABLE')
n, a, b = map(int, input().split())
s = 0
for i in range(1, n + 1):
  t = sum(list(str(i)))
  if a <= sum(list(str(i))) <= b:
    s += t
print(s)

### FIXED CODE ###

n, a, b = map(int, input().split())
s = 0
for i in range(1, n + 1):
  t = sum([int(j) for j in str(i)])
  if a <= t <= b:
    s += i
print(s)
# -*- coding: utf-8 -*-

import random
def qui(l):
    num = len(l)
    if num <= 1:
        return l
    piv = random.randrange(0,len(l))
    piv2 = random.randrange(0,len(l))
    piv3 = random.randrange(0,len(l))
    if (l[piv] > l[piv2]) and (l[piv2] > l[piv3]):
        piv = piv2
    elif (l[piv] > l[piv3]) and (l[piv3] > l[piv2]):
        piv = piv3
    elif (l[piv] < l[piv2]) and (l[piv2] < l[piv3]):
        piv = piv2
    elif (l[piv] < l[piv3]) and (l[piv3] < l[piv2]):
        piv = piv3
    else:
        pass
    mini = []
    maxi = []

    for i in range(0,len(l)):
        if i == piv:
            continue
        if l[piv] > l[i]:
            mini.append(l[i])
        elif l[piv] <= l[i]:
            maxi.append(l[i])
    mini = qui(mini)
    maxi = qui(maxi)
    return mini+maxi
input()
list1 = input().split(" ")
for i in range(0, len(list1)):
    list1[i] = int(list1[i])

result = qui(list1)

print(' '.join(map(str, result)))

### FIXED CODE ###

# -*- coding: utf-8 -*-

import random
def qui(l):
    num = len(l)
    if num <= 1:
        return l
    piv = random.randrange(0,len(l))
    piv2 = random.randrange(0,len(l))
    piv3 = random.randrange(0,len(l))
    if (l[piv] > l[piv2]) and (l[piv2] > l[piv3]):
        piv = piv2
    elif (l[piv] > l[piv3]) and (l[piv3] > l[piv2]):
        piv = piv3
    elif (l[piv] < l[piv2]) and (l[piv2] < l[piv3]):
        piv = piv2
    elif (l[piv] < l[piv3]) and (l[piv3] < l[piv2]):
        piv = piv3
    else:
        pass
    mini = []
    middlei = []
    maxi = []

    for i in range(0,len(l)):
        if l[i] == l[piv]:
            middlei.append(l[i])
        elif l[piv] > l[i]:
            mini.append(l[i])
        elif l[piv] <= l[i]:
            maxi.append(l[i])
    mini = qui(mini)
    maxi = qui(maxi)
    return mini+ middlei+maxi
input()
list1 = input().split(" ")
for i in range(0, len(list1)):
    list1[i] = int(list1[i])

result = qui(list1)

print(' '.join(map(str, result)))
a,b,c,d = list(map(int,input().split()))
cou = 0
if a is b:
  cou +=1
elif b is c:
  cou +=1
elif c is d:
  cou +=1
else:
  print("Good")
if cou > 0:
  print("Bad")


### FIXED CODE ###

a = int(input())
b = a//1000
c = (a//100)%10
d = (a//10)%10
e = a%10
cou = 0
if b is c:
  cou = cou + 1
elif c is d:
   cou = cou + 1
elif d is e:
   cou = cou + 1
else:
  print("Good")
if cou > 0:
  print("Bad")
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
 
N, Q = map(int, input().split())
V = {i: [] for i in range(1,N+1)}
for _ in range(N-1):
    a, b = map(int, input().split())
    V[a].append(b)
    V[b].append(a)
C = {i: 0 for i in range(1,N+1)}
 
for _ in range(Q):
    p, x = map(int, input().split())
    C[p] += x
 
 
def propagate(u, p):
    C[u] += C[p]
    for v in V[u]:
        if v == p:
            continue
        propagate(v, u)

propagate(1, 0)
 
print(' '.join(str(C[i]) for i in range(1,N+1)))

### FIXED CODE ###

import sys

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

N, Q = map(int, input().split())
V = {i: [] for i in range(1, N + 1)}
for _ in range(N - 1):
    a, b = map(int, input().split())
    V[a].append(b)
    V[b].append(a)

C = {i: 0 for i in range(1, N + 1)}

for _ in range(Q):
    p, x = map(int, input().split())
    C[p] += x


def propagate(u, p):
    for v in V[u]:
        if v == p:
            continue
        C[v] += C[u]
        propagate(v, u)


propagate(1, 0)

print(' '.join(str(C[i]) for i in range(1, N + 1)))
N, M = map(int, input().split())
a = [int(input())for i in range(M)]
MOD = 10 ** 9 + 7
dp = [0] * (N + 1)

dp[0] = 0
dp[1] = 1 if 1 not in a else 0
dp[2] = 1 if 2 not in a else 0
for i in range(3, N + 1):
    if i in a:
        dp[i] = 0
    else:
        dp[i] = dp[i - 1] + dp[i - 2]

print(dp[N] % MOD)


### FIXED CODE ###

N, M = map(int, input().split())
a = [int(input())for i in range(M)]
MOD = 10 ** 9 + 7
ans = []
dp = [1] * (N + 1)

for i in a:
    dp[i] = 0

for i in range(2, N + 1):
    if dp[i] != 0:
        dp[i] = (dp[i - 1] + dp[i - 2])

print(dp[N] % MOD)
N=Int(input())
S=input()
for i in range(N):
  SR=S[(i+1):]
  SL=S[:(i+1)]
  count=0
  for j in SL:
    for k in SR:
  	  if(SL[j]===SR[k]):
    	count++
        break

  if(count_M<count):
  		count_M=count

print(count)
   

### FIXED CODE ###

N=int(input())
S=input()
count_M=0
for i in range(N):
	SR=S[(i+1):]
	SL=S[:(i+1)]
	count = 0
	for j in range(len(SL)):
		for k in range(len(SR)):
			if(SL[j] == SR[k]):
				count+=1
				SR=SR.replace(SR[k],' ')
	
	if(count_M < count):
		count_M=count

print(count_M)
import heapq
X, Y, Z, K = map(int, input().split())
A_array = list(map(int, input().split()))
B_array = list(map(int, input().split()))
C_array = list(map(int, input().split()))

A_array.sort()
B_array.sort()
C_array.sort()

use_array = []
sum_array = []

candidate = []
heapq.heapify(candidate)

max_sum = A_array[-1] + B_array[-1] + C_array[-1]

heapq.heappush(candidate, (0, X - 1, Y - 1, Z - 1))
use_array.append((X - 1, Y - 1, Z - 1))
for i in range(K):

    s, x, y, z = heapq.heappop(candidate)

    sum_array.append(s)
    if x != 0 and (X - 1, Y, Z) not in use_array:
        use_array.append((X - 1, Y, Z))
        diff = A_array[x] - A_array[x - 1]
        heapq.heappush(candidate, (s + diff, x - 1, y, z))

    if y != 0 and (X, Y - 1, Z) not in use_array:
        use_array.append((X, Y - 1, Z))
        diff = B_array[y] - B_array[y - 1]
        heapq.heappush(candidate, (s + diff, x, y - 1, z))

    if z != 0 and (X, Y, Z - 1) not in use_array:
        use_array.append((X, Y, Z - 1))
        diff = C_array[z] - C_array[z - 1]
        heapq.heappush(candidate, (s + diff, x, y, z - 1))

for ans in sum_array:
    print(max_sum - ans)

### FIXED CODE ###

import heapq
X, Y, Z, K = map(int, input().split())
A_array = list(map(int, input().split()))
B_array = list(map(int, input().split()))
C_array = list(map(int, input().split()))

A_array.sort()
B_array.sort()
C_array.sort()

use_array = []
sum_array = []

candidate = []
heapq.heapify(candidate)

max_sum = A_array[-1] + B_array[-1] + C_array[-1]

heapq.heappush(candidate, (0, X - 1, Y - 1, Z - 1))
use_array.append((X - 1, Y - 1, Z - 1))

for i in range(K):
    s, x, y, z = heapq.heappop(candidate)

    sum_array.append(s)
    if x != 0 and (x - 1, y, z) not in use_array:
        use_array.append((x - 1, y, z))
        diff = A_array[x] - A_array[x - 1]
        heapq.heappush(candidate, (s + diff, x - 1, y, z))

    if y != 0 and (x, y - 1, z) not in use_array:
        use_array.append((x, y - 1, z))
        diff = B_array[y] - B_array[y - 1]
        heapq.heappush(candidate, (s + diff, x, y - 1, z))

    if z != 0 and (x, y, z - 1) not in use_array:
        use_array.append((x, y, z - 1))
        diff = C_array[z] - C_array[z - 1]
        heapq.heappush(candidate, (s + diff, x, y, z - 1))

for ans in sum_array:
    print(max_sum - ans)
n = int(input())
p = [[int(i) for i in input().split()] for i in range(n)]

max = 100

for posX in range(0,101) :
    for posY in range(0,101) :
        needH = -1
        
        for i in range(0,n) :
            if p[i][2] > 0 :
                tmp = p[i][2] + abs(posY-p[i][1]) + abs(posX - p[i][0])
                if needH == -1 :
                    needH = tmp
            else :
                if needH != tmp :
                    needH = -2
                    break
        if needH == -2 : continue
            
        for i in range(0,n) :
            if p[i][2] == 0 :
                dist =  abs(posY-p[i][1]) + abs(posX - p[i][0])
                if needH > dist :
                    needH = -2
                    break
        if needH == -2 : continue
        
        print(posX, posY, needH)
        break
    break

### FIXED CODE ###

def execute() :
    n = int(input())
    p = [[int(i) for i in input().split()] for i in range(n)]
    
    for posX in range(101) :
        for posY in range(101) :
            needH = -1
    
            for i in range(n) :
                x, y, h = p[i]
                if h > 0 :
                    tmp = h + abs(posY-y) + abs(posX-x)
                    if needH == -1 :
                        needH = tmp
                    else :
                        if needH != tmp :
                            needH = -2
                            break
            if needH == -2 : 
                continue
    
            for i in range(n) :
                x, y, h = p[i]
                if h == 0 :
                    dist =  abs(posY-y) + abs(posX - x)
                    if needH > dist :
                        needH = -2
                        break
            if needH == -2 : 
                continue
            
            return (posX, posY, needH)

result = execute()     
print(result[0], result[1], result[2])
import sys
import numpy as np
import numba
from numba import njit
i8 = numba.int64

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

@njit((i8, ), cache=True)
def popcount(n):
    ret = 0
    while n:
        ret += n & 1
        n >>= 1
    return ret


@njit((i8, ), cache=True)
def f(n):
    t = 0
    while n:
        t += 1
        n %= popcount(n)
    return t

@njit((i8[:]), cache=True)
def main(X):

    popX = X.sum()
    MOD1 = popX + 1
    MOD2 = popX - 1
    if popX == 1:
        MOD2 = 1
    pow1 = np.ones_like(X)
    pow2 = np.ones_like(X)
    for n in range(1, len(X)):
        pow1[n] = 2 * pow1[n - 1] % MOD1
        pow2[n] = 2 * pow2[n - 1] % MOD2

    X1, X2 = 0, 0
    for x in X:
        X1 = (2 * X1 + x) % MOD1
        X2 = (2 * X2 + x) % MOD2

    ans = np.empty(N, np.int64)
    for i in range(N):
        x = X[N - 1 - i]
        if x == 0:
            nxt = (X1 + pow1[i]) % (popX + 1)
            ans[i] = 1 + f(nxt)
        elif x == 1:
            if popX == 1:
                ans[i] = 0
            else:
                nxt = (X2 - pow2[i]) % (popX - 1)
                ans[i] = 1 + f(nxt)
    return ans[::-1]

N = int(readline())
X = np.array(list(read().rstrip()), np.int64) - ord('0')
ans = main(X)
print('\n'.join(map(str, ans.tolist())))


### FIXED CODE ###

import sys
import numpy as np
import numba
from numba import njit
i8 = numba.int64

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(readline())
X = np.array(list(read().rstrip()), np.int64) - ord('0')

@njit((i8, ), cache=True)
def popcount(n):
    ret = 0
    while n:
        ret += n & 1
        n >>= 1
    return ret


@njit((i8, ), cache=True)
def f(n):
    t = 0
    while n:
        t += 1
        n %= popcount(n)
    return t

@njit(cache=True)
def main(X):

    popX = X.sum()
    MOD1 = popX + 1
    MOD2 = popX - 1
    if popX == 1:
        MOD2 = 1
    pow1 = np.ones_like(X)
    pow2 = np.ones_like(X)
    for n in range(1, len(X)):
        pow1[n] = 2 * pow1[n - 1] % MOD1
        pow2[n] = 2 * pow2[n - 1] % MOD2

    X1, X2 = 0, 0
    for x in X:
        X1 = (2 * X1 + x) % MOD1
        X2 = (2 * X2 + x) % MOD2

    ans = np.empty(N, np.int64)
    for i in range(N):
        x = X[N - 1 - i]
        if x == 0:
            nxt = (X1 + pow1[i]) % (popX + 1)
            ans[i] = 1 + f(nxt)
        elif x == 1:
            if popX == 1:
                ans[i] = 0
            else:
                nxt = (X2 - pow2[i]) % (popX - 1)
                ans[i] = 1 + f(nxt)
    return ans[::-1]

ans = main(X)
print('\n'.join(map(str, ans.tolist())))
n=int(input())
t=list(map(int,input().split()))
m=int(input())
drink=[]
all=sum(t)
for i in range(m):
  drink.append(list(map(int,input().split())))
for j in range(m):
  print(all-t[drink[j][0]]+drink[j][1])

### FIXED CODE ###

n=int(input())
t=list(map(int,input().split()))
m=int(input())
drink=[]
all=sum(t)
for i in range(m):
  drink.append(list(map(int,input().split())))
for j in range(m):
  if drink[j][0]<=n:
    print(all-t[drink[j][0]-1]+drink[j][1])
  else:
    print(all)
A = int(input())
B = int(input())

if A <= 9 and B <= 9:
  print(A * B)
else:
  print('-1')

### FIXED CODE ###

A = list(map(int, input().split()))

if A[0] <= 9 and A[1] <= 9:
  print(A[0] * A[1])
else:
  print('-1')
from math import factorial
N, a, b = map(int, input().split())
m=0
for i in range(N):
    if i==a, or i==b
        k=0
        m=m+k
    if not i== a-1 or i==b-1:
        k= factorial(N) // ((factorial(N - (i+1)) * factorial(i+1)))
        m=m+k
    print(m)


### FIXED CODE ###

N,R=map(int, input().split()) 
if N>=10:
    print(R)
if 0<=N<10:
    print(R+100*(10-N))
# coding:utf-8
n,k = map(int, input().split())
h = list(map(int, input().split()))
dp = [float('inf')] * n

#後者が前者よりも小さい時に更新→DPテーブルをinfに初期化(先頭は0)
def chmin(a,b):
    if(a > b):
        return b
    else:
        return a

def main():
    dp[0] = 0
    #今判明しているtable
    for i in range(n):
        #nextstep
        for j in range(1,n):
            dp[i+j] = chmin(dp[i+j], dp[i]+abs(h[i]-h[i+j]))
    
    print(dp[n-1])

if __name__ == '__main__' :
    main()

### FIXED CODE ###

# coding:utf-8
import numpy as np
n,k = map(int, input().split())
h = list(map(int, input().split()))
dp = np.zeros(n, dtype=int)
h = np.array(h)

def main():
    #今判明しているtable
    for i in range(1,n):
        start = max(0, i-k)
        dp[i] = min(dp[start: i] + np.abs(h[i] - h[start:i]))
    
    print(dp[n-1])

if __name__ == '__main__' :
    main()
import itertools

N, M = input().split()
N = int(N)
M = int(M)

h = [int(i) for i in input().split()]

List = [list(map(int, input().split())) for i in range(M)]
f_list=list(itertools.chain.from_iterable(List))

cnt=0


for i in range(1,N+1):
  if f_list.count(i)==0:
    cnt+=1


ToF = [0] * N


for i in range(0, M):
    tmp1 = List[i][1] - 1
    tmp2 = List[i][0] - 1
    diff = h[tmp1] - h[tmp2]
    if diff > 0:
        ToF[List[i][1] - 1] = 1

print(ToF.count(1)+cnt)

  
  

### FIXED CODE ###

str=input()

if str=='ABC':
  print('ARC')
elif str=='ARC':
  print('ABC')
import numpy as np

n,k = map(int, input().split())

cnt = np.array(list([0]*n))

for i in range(k):
    d = int(input())
    a = np.array([list(map(int, input().split()))])
    a = np.append(a,[0]*(n-d))
    cnt += a

print(np.count_nonzero(cnt==0))

### FIXED CODE ###

import numpy as np

n,k = map(int, input().split())

cnt = np.array(list([0]*n))

for _ in range(k):
    d = int(input())
    a = np.array(list(map(int, input().split())))
    for i in a:
        cnt[i-1] += 1

print(np.count_nonzero(cnt==0))
import math
Input = input()
a, b, c, d = Input.split()
a, b, c, d = int(a), int(b), int(c), int(d)
c_min = int(a/c) if a % c == 0 else int(a/c) + 1
c_max = int(b/c)
delta_c = c_max - c_min + 1
d_min = int(a/d) if a % c == 0 else int(a/d) + 1
d_max = int(b/d)
delta_d = d_max - d_min + 1
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
cd = lcm(c, d)
cd_min = int(a/cd) if a % c == 0 else int(a/cd) + 1
cd_max = int(b/cd)
delta_cd = cd_max -cd_min + 1
num_cd = delta_c + delta_d - delta_cd
print( b-a+1 - num_cd, end='')

### FIXED CODE ###

# 同じ数字が連続していないこと
passward = input()


def detector(passward):
    passward_list = list(passward)
    for i in range(len(passward)-1):
        if passward_list[i] == passward_list[i+1]:
            print('Bad', end='')
            break
        else :
            if i == len(passward)-2:
                print('Good', end='')
            continue
        

detector(passward)
A = int(input())

count =  0

if A<10:
    count= A
elif A <100:
    count = 9 
elif A < 1000:
    count = 9 + A - 99
elif A < 10000:
    count = 9 + 900
elif A < 100000:
    count = 9 + 900 + (A-9999)
elif A =100000:
    count = 90909
else:
    

print(count)


### FIXED CODE ###

A = int(input())

count =  0

if A<10:
    count= A
elif A <100:
    count = 9 
elif A < 1000:
    count = 9 + A - 99
elif A < 10000:
    count = 9 + 900
elif A < 100000:
    count = 9 + 900 + (A-9999)
else:
    count = 90909
    

print(count)
import sys
from collections import defaultdict

n , q = map(int, sys.stdin.readline().split())

graph = defaultdict(list)
for i in range(n-1):
	x, y = map(int, sys.stdin.readline().split())
	graph[x].append(y)
	graph[y].append(x)

def dfs(src, p):
	global graph, lazy

	for neighbour in graph[src]:
		if neighbour != p:
			lazy[neighbour] += lazy[src]
			dfs(neighbour, src)

lazy = [0]*(n+1)
for _ in range(q):
	idx, val = map(int, sys.stdin.readline().split())
	lazy[idx] += val
dfs(1, -1)
print(*lazy[1:])

### FIXED CODE ###

import sys
from collections import defaultdict

n , q = map(int, sys.stdin.readline().split())

lazy = [0]*(n+1)

graph = defaultdict(lambda:list([]))
for i in range(n-1):
	x, y = map(int, sys.stdin.readline().split())
	# x, y = arr[i]
	graph[x].append(y)
	graph[y].append(x)

def dfs(src):
	visited ={src, }
	stack = [src]

	while stack:
		v = stack.pop()
		for next_v in graph[v]:
			if not next_v in visited:
				visited.add(next_v)
				lazy[next_v] += lazy[v]
				stack.append(next_v)

# queries = [(1, 1), (2, 2)]
for i in range(q):
	idx, val = map(int, sys.stdin.readline().split())
	# idx, val = queries[i]
	lazy[idx] += val
dfs(1)
print(*lazy[1:])
n=int(input())
a=[int(i) for i in input().split()]
a=sorted(a)[::-1]
print(sum[1:2*n:2])

### FIXED CODE ###

n=int(input())
a=sorted([int(i) for i in input().split()])[::-1]
print(sum(a[1:2*n:2]))
import math 
from functools import reduce
N = int(input())
A = list(map(int, input().split()))
ans = ["pairwise coprime", "setwise coprime ", "not coprime"]

def gcd_list(numbers):
    return reduce(math.gcd, numbers)
  
if gcd_list(A) != 1:
  print(ans[2])
  quit()
  
def seachPrimeNum(N):
    max = int(N ** (1 / 2))
    D = [0] * N
    D[0] = 1
    seachList = [i for i in range(2,N+1)]
    primeNum = []
    while seachList[0] <= max:
        nn = seachList[0]
        D[nn - 1] = nn
        primeNum.append(nn)
        tmp = nn
        for i in seachList:
          if i != nn:
            if i % tmp == 0:
              D[i - 1] = nn
        seachList = [i for i in seachList if i % tmp != 0]
    for i in seachList:
      D[i - 1] = i
    primeNum.extend(seachList)
    
    return primeNum, D  
  
primeNum, D = seachPrimeNum(1000000)
used = [0] * len(primeNum)

for i in range(N):
  now = A[i]
  #print(now, D[now - 1])
  while now != D[now - 1]:
    now = int(now / D[now - 1])
    if now in primeNum:
      q.append(now)
  q.append(now)    
  for i in q:
    if used[primeNum.index(i)] == 0:
      used[primeNum.index(i)] = 1
    else:
      print(ans[1])
      quit()  

print(ans[0])


### FIXED CODE ###

from math import gcd
n = int(input())
a = [int(i) for i in input().split()]

g = a[0]
for i in range(n):
    g = gcd(g,a[i])
if g != 1:
    print("not coprime")
    exit()

m = max(a)
fac = [1]*(m+1)
for i in range(2,m+1):
    if fac[i] != 1:
      continue
    for j in range(i,m+1,i):
      fac[j] = i
      
s = set()
for i in range(n):
    x = fac[a[i]]
    if x == 1: 
      continue
    if x in s:
      print("setwise coprime")
      exit()
    s.add(x)
print("pairwise coprime")
a = list(input())
b = list(input())

a.sort()
b.sort(reverse=True)


for i in range(int(len(b))):
    c =(a[i],b[i])
    d = sorted(c)
    if i != int(len(b))-1:
        if a[i] == b[i]:
            continue
        elif c == d and a[i] != b[i]:
            print("No")
            break
        else:
            print("Yes")
            break
    if i == int(len(b))-1:
        if a[i] == b[i]:
            if int(len(a)) >= int(len(b)):
                print("No")
            else:
                print("Yes")
        elif c == d and a[i] != b[i]:
            print("No")
            break
        else:
            print("Yes")
            break


### FIXED CODE ###

a = list(input())
b = list(input())

a.sort()
b.sort(reverse=True)
f = [int(len(b)), int(len(a))]
e = min(f)
for i in range(int(e)):
    c =[a[i],b[i]]
    d = sorted(c)
    if i != int(e)-1:
        if a[i] == b[i]:
            continue
        elif c != d:
            print("No")
            break
        else:
            print("Yes")
            break
    if i == int(e)-1:
        if a[i] == b[i]:
            if int(len(a)) >= int(len(b)):
                print("No")
            else:
                print("Yes")
        elif c != d:
            print("No")
            break
        else:
            print("Yes")
            break
#coding : utf8

import math

"""
@param {int}
@return {int}
"""
def calcPow(X):
    num = int(math.sqrt(X))
    Max = 0

    for i in range(2,num+1):
        for j in range(2,num+1):
            if(pow(i,j) > X):
                if(pow(i,j-1) > Max):
                    Max = pow(i,j-1)
                    break
                break

    return Max


if __name__ == '__main__':
    X = int(input())

    print(calcPow(X))


### FIXED CODE ###

#coding : utf8

"""
@param {int}
@return {bool}
"""
def calcDistance(a,b,c,d):

    if( abs(a-c) <= d ):
        return True
    elif( abs(a-b) <= d and abs(b-c) <= d ):
        return True
    else:
        return False

if __name__ == '__main__':
    a,b,c,d = map(int, input().split())

    if(calcDistance(a,b,c,d)):
        print("Yes")
    else:
        print("No")
#!usr/bin/env python3

def string_number_spliter():
    a, b = [int(i) for i in input().split()]
    return a, b


def main():
    a, b = string_number_spliter()

    if (a < b):
        print(str(a) + " < " str(b))
    elif (a < b):
        print(str(a) + " > " str(b))
    else:
        print(str(a) + " == " str(b))


if __name__ == '__main__':
    main()

### FIXED CODE ###

#!usr/bin/env python3

def string_two_numbers_spliter():
    a, b = [int(i) for i in input().split()]
    return a, b


def main():
    a, b = string_two_numbers_spliter()

    if a < b:
        print('a < b')
    elif a > b:
        print('a > b')
    else:
        print('a == b')


if __name__ == '__main__':
    main()
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 CODE ###

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)