#include<stdio.h> int main(){ int N,h; int a[3][100],b[100]; int i,j,p,x,y,h_min = 0; scanf("%d",&N); for(i = 0;i < N;i++){ scanf("%d",&a[0][i]); scanf("%d",&a[1][i]); scanf("%d",&a[2][i]); } for(i = 0;i < 100;i++){ for(j = 0;j < 100;j++){ for(p = 0,h_min = 0;p < N;p++){ b[p] = abs(i - a[0][p]) + abs(j - a[1][p]) + a[2][p]; if(a[2][p] != 0){ if(b[p] <= h_min || p == 0) h_min = b[p]; } } for(p = 0;p < N;p++){ if(a[2][p] != 0){ if(b[p] != h_min) break; } else { if(b[p] > h_min) break; } if(p == N) h = h_min,x=i,y=j; } } } printf("%d %d %d",x,y,h); } int abs(int x){ if(x >= 0) return x; else return -x; }