stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include <iostream>

#include <vector>

#include <algorithm>

#include <math.h>

#include <numeric>

#include <set>

#include <map>

#include <stack>

#include <queue>

#include <time.h>

#include <list>



using namespace std;

typedef long long ll;

#define rep(i,n) for(int i=0;i<(n);++i)

#define FOR(i,a,b) for(int i=(a);i<(b);++i)

#define reps(x,c) for(auto x:c)

#define all(x) begin(x), end(x)

#define pb(a) emplace_back(a) 

#define mp(a,b) make_pair((a),(b))

#define pl pair<ll,ll>

#define INF 1e18

#define MOD 1000000007

#define fi first

#define se second

#define dbg(x) cout << #x"="<< (x) << endl

#define dbgv(x) cout<<#x<<endl;reps(y,x){cout<<y<<" ";}cout<<endl





ll c[110][110];

ll d[110][110];



int main(){

  ll n;cin>>n;

  vector<ll> x(n),y(n),h(n);

  rep(i,n){

    cin>>x[i]>>y[i]>>h[i];

  }



  rep(i,101){

    rep(j,101){

      c[i][j]=INF;

      rep(k,n){

        if(h[k]==0){

          c[i][j]=min(abs(x[k]-i)+abs(y[k]-j),c[i][j]);

        }

      }

    }

  }



  rep(i,101){

    rep(j,101){

      rep(k,n){

        if(h[k]!=0){

          if(d[i][j]==0){

            d[i][j]=abs(x[k]-i)+abs(y[k]-j)+h[k];

          }else{

            if(d[i][j]!=abs(x[k]-i)+abs(y[k]-j)+h[k]){

              d[i][j]=-1;

            }

          }

        }

      }

    }

  }



  rep(i,101){

    rep(j,101){

      if(d[i][j]>0&&d[i][j]<=c[i][j]){

        cout<<i<<" "<<j<<" "<<d[i][j]<<endl;

        return 0;        

      }

    }

  }



  rep(i,101){

    rep(j,101){

      if(d[i][j]==0&&INF>c[i][j]){

        cout<<i<<" "<<j<<" "<<c[i][j]<<endl;

        return 0;        

      }

    }

  }



  return 0;

}

// Optimized solution to the same problem (faster):
#include <iostream>

#include <vector>

#include <algorithm>

#include <math.h>

#include <numeric>

#include <set>

#include <map>

#include <stack>

#include <queue>

#include <time.h>

#include <list>



using namespace std;

typedef long long ll;

#define rep(i,n) for(int i=0;i<(n);++i)

#define FOR(i,a,b) for(int i=(a);i<(b);++i)

#define reps(x,c) for(auto x:c)

#define all(x) begin(x), end(x)

#define pb(a) emplace_back(a) 

#define mp(a,b) make_pair((a),(b))

#define pl pair<ll,ll>

#define INF 1e18

#define MOD 1000000007

#define fi first

#define se second

#define dbg(x) cout << #x"="<< (x) << endl

#define dbgv(x) cout<<#x<<endl;reps(y,x){cout<<y<<" ";}cout<<endl



int main(){

  ll X,Y,H,n;cin>>n;vector<ll> x(n),y(n),h(n);

  rep(i,n){

    cin>>x[i]>>y[i]>>h[i];

    if(h[i]>0){

      X=x[i];

      Y=y[i];

      H=h[i];

    }

  }

  ll H_cand;

  bool flg=true;

  rep(i,101){

    rep(j,101){

      H_cand=H+abs(i-X)+abs(j-Y);

      flg=true;

      rep(k,n){

        if(h[k]!=max(H_cand-abs(i-x[k])-abs(j-y[k]),0ll)){

          flg=false;

          break;

        }

      }

      if(flg){

        cout<<i<<" "<<j<<" "<<H_cand<<endl;

        return 0;

      }

    }

  }  

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
    #include <iostream>

    #include <vector>

    #include <algorithm>

    #include <tuple>

    using namespace std;

     

    long long N, X[1009], Y[1009], H[1009]; vector<tuple<long long, long long, long long>>vec;

     

    int main() {

    	cin >> N; tuple<long long, long long, long long>G = make_tuple(-1, -1, -1);

    	for (int i = 1; i <= N; i++) {

    		cin >> X[i] >> Y[i] >> H[i];

    		if (H[i] >= 1) G = make_tuple(X[i], Y[i], H[i]);

    	}

    	for (int i = 0; i <= 100; i++) {

    		for (int j = 0; j <= 100; j++) {

    			long long V = get<2>(G) + abs(get<0>(G) - i) + abs(get<1>(G) - j); V = max(V, 0LL); bool flag = true;

    			for (int k = 1; k <= N; k++) {

    				long long VV = V - abs(X[k] - i) - abs(Y[k] - j); VV = max(VV, 0LL);

    				if (H[k] != VV) flag = false;

    			}

    			if (flag == true) vec.push_back(make_tuple(i, j, V));

    		}

    	}

    	if (vec.size() == 1) {

    		cout << get<0>(vec[0]) << " " << get<1>(vec[0]) << " " << get<2>(vec[0]) << endl;

    	}

    	return 0;

    }

// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

typedef long long ll;

using namespace std;



int main(){

    int n; cin >> n;

    int able;

    vector<ll> x(n), y(n), h(n);

    for(int i = 0; i < n; i++){

        cin >> x[i] >> y[i] >> h[i];

        if(h[i] > 0){

            able = i;

        }

    }

    int flag = 1;

    for(int i = 0; i <= 100; i++){

        for(int l = 0; l <= 100; l++){

            flag = 1;

            ll H = h[able] + abs(x[able] - i) + abs(y[able] - l);

            for(int k = 0; k < n; k++){

                ll a = max(H - abs(x[k] - i) - abs(y[k] - l), 0LL);

                if(h[k] != a){

                    flag = 0;

                    break;

                } 

            }

            if(flag == 1){

                if(H == 0){continue;}

                cout << i << ' ' <<l << ' ' <<H << endl;

                return 0;

            }

        }

    }

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<algorithm>

using namespace std;

int n,x[100],y[100],h[100];

main()

{

	cin>>n;

	for(int i=0;i<n;i++)cin>>x[i]>>y[i]>>h[i];

	for(int cx=0;cx<=100;cx++)

	{

		for(int cy=0;cy<=100;cy++)

		{

			int H;

			for(int i=0;i<n;i++)

			{

				if(h[i])

				{

					H=h[i]+abs(x[i]-cx)+abs(y[i]-cy);

					break;

				}

			}

			bool flag=1;

			for(int i=0;i<n;i++)

			{

				flag&=h[i]==max(H-abs(x[i]-cx)-abs(y[i]-cy),0);

			}

			if(flag)

			{

				cout<<cx<<" "<<cy<<" "<<H<<endl;

				return 0;

			}

		}

	}

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int abs(int i){

	if(i >= 0){

		return i;

	}else{

		return -i;

	}

}



long long int  max(long long int i){

	if(i > 0){

		return i;

	}else{

		return 0;

	}

}



int main(void)

{

	int n;

	scanf("%d",&n);

	int x[n],y[n],i;

	long long int h[n];

	

	for(i = 0; i < n; i++){

		scanf("%d %d %lld",&x[i],&y[i],&h[i]);

	}

	

	int cx,cy;

	

	for(cx = 0; cx < 101; cx++){

		for(cy = 0; cy < 101; cy++){

			long long int geth;

			for(i = 0; i < n; i++){

				if(h[i]!=0){

					geth = h[i] + abs(x[i] - cx) + abs(y[i] - cy);

					break;

				}

			}

			bool flag=true;

			for(i=0;i<n;i++){

				if(h[i]!=max(geth-abs(x[i]-cx)-abs(y[i]-cy)))flag=false;

			}

			if(flag)

			{

				printf("%d %d %lld\n",cx,cy,geth);

				return 0;

			}

		}

	}

	

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<cstdio>

#include<iostream>

#include<cstdlib>

#include<cmath>

#include<vector>

#include<map>

#include<algorithm>



using namespace std;



typedef struct {

    int x;

    int y;

    long long h;

} XYH;



int main()

{

    int N;

    cin >> N;



    XYH xyh_ref;

    vector<XYH> xyh;

    for (int i = 0; i < N; i++) {

        int x, y;

        long long h;

        cin >> x >> y >> h;

        XYH xyh_i = {x, y, h};

        xyh.push_back(xyh_i);

        if (h > 0) {

            xyh_ref = xyh_i;

        }

    }



    int Cx, Cy;

    long long H;

    for (Cx = 0; Cx <= 100; Cx++) {

        for (Cy = 0; Cy <= 100; Cy++) {

            H = abs(xyh_ref.x - Cx) + abs(xyh_ref.y - Cy) + xyh_ref.h;

            bool flag = true;



            for (int i = 0; i < xyh.size(); i++) {

                long long h = max(H - abs(xyh[i].x - Cx) - abs(xyh[i].y - Cy), 0LL);

                

                if (h != xyh[i].h) {

                    flag = false;

                }

            }



            if (flag) {

                cout << Cx << " " << Cy << " " << H << endl;

            }

        }

    }





    return 0;

}


// Optimized solution to the same problem (faster):
#include<cstdio>

#include<iostream>

#include<cstdlib>

#include<cmath>

#include<vector>

#include<map>

#include<algorithm>



using namespace std;



typedef struct {

    int x;

    int y;

    long long h;

} XYH;



int main()

{

    int N;

    cin >> N;



    XYH xyh_ref;

    vector<XYH> xyh;

    for (int i = 0; i < N; i++) {

        int x, y;

        long long h;

        cin >> x >> y >> h;

        XYH xyh_i = {x, y, h};

        xyh.push_back(xyh_i);

        if (h > 0) {

            xyh_ref = xyh_i;

        }

    }



    for (int Cx = 0; Cx <= 100; Cx++) {

        for (int Cy = 0; Cy <= 100; Cy++) {

            long long H = abs(xyh_ref.x - Cx) + abs(xyh_ref.y - Cy) + xyh_ref.h;

            bool flag = true;



            for (int i = 0; i < xyh.size(); i++) {

                long long h = max(H - abs(xyh[i].x - Cx) - abs(xyh[i].y - Cy), 0LL);

                if (h != xyh[i].h) {

                    flag = false;

                    break;

                }

            }



            if (flag) {

                cout << Cx << " " << Cy << " " << H << endl;

                return 0;

            }

        }

    }



    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>



#define fr first

#define sc second

#define pb push_back

#define mk make_pair

#define mt make_tuple

#define int long long

#define OK puts("OK")

#define sz(s) (int)s.size()

#define all(s) s.begin(), s.end()



using namespace std;





int N, X[1009], Y[1009], H[1009];

vector< tuple < int , int , int > > v;



 main() {

	cin >> N;

	tuple < int , int , int > G = mt ( -1 , -1 , -1 ) ;

	for (int i = 1; i <= N; i++)

    {

		cin >> X[i] >> Y[i] >> H[i];

		if ( H[i] >= 1)

		G = mt (X[i], Y[i], H[i]);

	}

    for (int j = 0; j <= 100; j++)

	 {

	   for (int i = 0; i <= 100; i++)

        {

			int V = get<2> (G) + abs ( get<0> (G) - i) + abs(get<1>(G) - j);

            V = max(V, 0LL);

            bool f = true;



			for (int k = 1; k <= N; k++)

            {

				int VV = V - abs( X[k] - i) - abs ( Y[k] - j );

                VV = max(VV, 0LL);

				if (H[k] != VV)

                    f = false;

			}

			if (f == true)

                v.push_back(make_tuple(i, j, V));

		}

	}



    cout << get<0> ( v[0] ) << " " << get<1> ( v[0] ) << " " << get<2> (v[0]) << endl;



}




// Optimized solution to the same problem (faster):
#include<iostream>

#include<string>

#include<cstdio>

#include<algorithm>

using namespace std;



int main()

{

    int C_X,C_Y,H,k;

    int N,x[101],y[101],h[101],flat=0;

    cin>>N;

    for(int i=0; i<N; i++)

    {

        cin>>x[i]>>y[i]>>h[i];

        if(h[i]!=0)

            k=i;

    }

    for(C_X=0; C_X<=100; C_X++)

    {

        for(C_Y=0; C_Y<=100; C_Y++)

        {

            H=h[k]+abs(x[k]-C_X)+abs(y[k]-C_Y);

            if(h[0]==max(H-abs(x[0]-C_X)-abs(y[0]-C_Y),0))

            {

                int j;

                for(j=1; j<N; j++)

                {

                    if(h[j]!=max(H-abs(x[j]-C_X)-abs(y[j]-C_Y),0))

                        break;

                }

                if(j==N)

                {

                    flat=1;

                    printf("%d %d %d\n",C_X,C_Y,H);

                    break;

                }

            }

        }

        if(flat==1)

            break;

    }

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <math.h>

using namespace std;

struct pyrimid

{

	int h,x,y;

	inline int center(int& H,int& a,int& b)

	{

		int o = H - abs(x - a) - abs(y - b);

		return h ==( o > 0 ? o : 0);

	}

};

int main()

{

	int n,i,j,k;

	cin >> n;

	pyrimid *p = new pyrimid[n];

	for(i = 0;i < n;i ++)

		cin >> p[i].x >> p[i].y >> p[i].h;

	for(i = p[0].h,k = 1;k < n;k ++)

	{

		i = i > p[k].h ? i : p[k].h;

	}

	for(;;i ++)

		for(j = 0;j <= 100;j ++)

			for(k = 0;k <= 100;k ++)

			{	

				int f = 0;

				for(int g = 0;g < n;g ++)	

					if(p[g].center(i,j,k) == 1)

						f ++;

				if(f == n)

				{

					cout << j << ' ' << k << ' ' << i << endl;

					return 0;

				}

			}

}

// Optimized solution to the same problem (faster):
#include<iostream>

#include<cmath>

using namespace std;

struct infor

{

 int x;

 int y;

 int h;

};



infor in[101], in1[101], in2[101];

int main()

{

 int N;

 int i,j=0,k=0;

 int Xc, Yc;

 cin >> N;

 for (i = 0; i < N; i++)

 {

     cin >> in[i].x >> in[i].y >> in[i].h;

     if(in[i].h>0)

         in1[j++] = in[i];

     else

         in2[k++] = in[i];

 }

    

 int m;//m遍历数

    for(Xc = 0; Xc < 101; Xc++ )

    {

        for (Yc = 0; Yc < 101; Yc++ )

        {

            int H ;

            H = in1[0].h + abs(Xc - in1[0].x) + abs(Yc - in1[0].y);

            int flag1, flag2;

            flag1 = flag2 = 1;

            for (m = 1; m < j; m ++)

            {

                if (H == in1[m].h + abs(Xc - in1[m].x) + abs(Yc - in1[m].y));

                else

                {

                    flag1 = 0;

                    break;

                }

            }

            

            if(flag1)

            {

                for ( m = 0; m < k; m++ )

                    if( H - abs( in2[m].x - Xc ) - abs( in2[m].y - Yc ) > 0)

                    {

                        flag2 = 0;

                        break;

                    }

                if (flag2)

                {

                    cout << Xc << ' ' << Yc << ' ' << H;

                    return 0;

                }

            }

            else continue;

        }

    }

 }

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>



using namespace std;



typedef long long ll;

typedef unsigned long long ull;

typedef vector<int> vi;

typedef vector<ll> vl;

typedef pair<int, int> pii;

typedef pair<ll, ll> pll;



#define REP(i, n) for(int i=0; i<(n); ++i)

#define FOR(i, a, b) for(int i=(a); i<(b); ++i)

#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)



#define DEBUG(x) cout<<#x<<": "<<x<<'\n'

#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'

#define ALL(a) (a).begin(), (a).end()



#define CHMIN(a, b) a=min((a), (b))

#define CHMAX(a, b) a=max((a), (b))



const ll MOD=1000000007ll;

// const ll MOD=998244353ll;

#define FIX(a) ((a)%MOD+MOD)%MOD



const double EPS=1e-11;

#define EQ0(x) (abs((x))<EPS)

#define EQ(a, b) (abs((a)-(b))<EPS)



int main(){

	ios::sync_with_stdio(false);

	cin.tie(0);

	int n, x[114], y[114], h[114];

	cin>>n;

	REP(i, n){

		cin>>x[i]>>y[i]>>h[i];

	}

	REP(c1, 101){

		REP(c2, 101){

			FOR(H, h[0], h[0]+201){

				bool ok=true;

				REP(i, n){

					if(h[i]){

						if(H!=h[i]+abs(x[i]-c1)+abs(y[i]-c2)){

							ok=false;

							i=n;

						}

					}

					else if(H>abs(x[i]-c1)+abs(y[i]-c2)){

						ok=false;

						i=n;

					}

				}

				if(ok){

					cout<<c1<<' '<<c2<<' '<<H<<'\n';

					return 0;

				}

			}

		}

	}

	return 0;

}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define REP(i, n) for(int i=0; i<(n); ++i)



int main(){

	ios::sync_with_stdio(false);

	cin.tie(0);

	int n, x[114], y[114], h[114];

	cin>>n;

	REP(i, n){

		cin>>x[i]>>y[i]>>h[i];

	}

	REP(c1, 101){

		REP(c2, 101){

			bool f=false, ok=true;

			int H=1<<30;

			REP(i, n){

				if(f){

					if(h[i]==0){

						if(H>abs(x[i]-c1)+abs(y[i]-c2)){

							ok=false;

							i=n;

						}

					}

					else if(H!=h[i]+abs(x[i]-c1)+abs(y[i]-c2)){

						ok=false;

						i=n;

					}

				}

				else{

					if(h[i]==0){

						H=min(H, abs(x[i]-c1)+abs(y[i]-c2));

					}

					else if(H<h[i]+abs(x[i]-c1)+abs(y[i]-c2)){

						ok=false;

						i=n;

					}

					else{

						H=h[i]+abs(x[i]-c1)+abs(y[i]-c2);

						f=true;

					}

				}

			}

			if(ok && H>=1){

				cout<<c1<<' '<<c2<<' '<<H<<'\n';

				return 0;

			}

		}

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>



using namespace std;



typedef long long ll;

typedef unsigned long long ull;

typedef vector<int> vi;

typedef vector<ll> vl;

typedef pair<int, int> pii;

typedef pair<ll, ll> pll;



#define REP(i, n) for(int i=0; i<(n); ++i)

#define FOR(i, a, b) for(int i=(a); i<(b); ++i)

#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)



#define DEBUG(x) cout<<#x<<": "<<x<<'\n'

#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'

#define ALL(a) (a).begin(), (a).end()



#define CHMIN(a, b) a=min((a), (b))

#define CHMAX(a, b) a=max((a), (b))



const ll MOD=1000000007ll;

// const ll MOD=998244353ll;

#define FIX(a) ((a)%MOD+MOD)%MOD



const double EPS=1e-11;

#define EQ0(x) (abs((x))<EPS)

#define EQ(a, b) (abs((a)-(b))<EPS)



int main(){

	ios::sync_with_stdio(false);

	cin.tie(0);

	int n, a, x[114], y[114], h[114];

	cin>>n;

	REP(i, n){

		cin>>x[i]>>y[i]>>h[i];

		if(h[i]){

			a=i;

		}

	}

	REP(c1, 101){

		REP(c2, 101){

			FOR(H, h[a], h[a]+201){

				bool ok=true;

				REP(i, n){

					if(h[i]){

						if(H!=h[i]+abs(x[i]-c1)+abs(y[i]-c2)){

							ok=false;

							i=n;

						}

					}

					else if(H>abs(x[i]-c1)+abs(y[i]-c2)){

						ok=false;

						i=n;

					}

				}

				if(ok){

					cout<<c1<<' '<<c2<<' '<<H<<'\n';

					return 0;

				}

			}

		}

	}

	return 0;

}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define REP(i, n) for(int i=0; i<(n); ++i)



int main(){

	ios::sync_with_stdio(false);

	cin.tie(0);

	int n, x[114], y[114], h[114];

	cin>>n;

	REP(i, n){

		cin>>x[i]>>y[i]>>h[i];

	}

	REP(c1, 101){

		REP(c2, 101){

			bool f=false, ok=true;

			int H=1<<30;

			REP(i, n){

				if(f){

					if(h[i]==0){

						if(H>abs(x[i]-c1)+abs(y[i]-c2)){

							ok=false;

							i=n;

						}

					}

					else if(H!=h[i]+abs(x[i]-c1)+abs(y[i]-c2)){

						ok=false;

						i=n;

					}

				}

				else{

					if(h[i]==0){

						H=min(H, abs(x[i]-c1)+abs(y[i]-c2));

					}

					else if(H<h[i]+abs(x[i]-c1)+abs(y[i]-c2)){

						ok=false;

						i=n;

					}

					else{

						H=h[i]+abs(x[i]-c1)+abs(y[i]-c2);

						f=true;

					}

				}

			}

			if(ok && H>=1){

				cout<<c1<<' '<<c2<<' '<<H<<'\n';

				return 0;

			}

		}

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<iomanip>

#include<cmath>

#include<string>

#include<cstring>

#include<vector>

#include<list>

#include<algorithm>

#include<map>

#include<set>

#include<queue>

#include<stack>

using namespace std;

typedef long long ll;

#define fi first

#define se second

#define mp make_pair

#define rep(i, n) for(int i=0;i<n;++i)

#define rrep(i, n) for(int i=n;i>=0;--i)

const int inf=1e9+7;

const ll mod=1e9+7;

const ll mod1=998244353;

const ll big=1e18;

const double PI=2*asin(1);



int main() {

  int N;

  cin>>N;

  int x[N], y[N], h[N];

  for(int i=0;i<N;++i) cin>>x[i]>>y[i]>>h[i];

  int index;

  for(int i=0;i<N;++i) {

    if(h[i]>0) {

      index = i;

      break;

    }

  }

  bool ok;

  int height;

  int tmp;

  int Cx, Cy, H;

  for(int i=0;i<=100;++i) {

    for(int j=0;j<=100;++j) {

      height = h[index] + abs(x[index]-i) + abs(y[index]-j);

      ok = true;

      for(int k=0;k<N;++k) {

        tmp = max(0, height-abs(x[k]-i)-abs(y[k]-j));

        if(tmp!=h[k]) ok = false;

      }

      if(ok) {

        Cx = i;

        Cy = j;

        H = height;

      }

    }

  }

  cout<<Cx<<" "<<Cy<<" "<<H<<endl;

}




// Optimized solution to the same problem (faster):
#include<iostream>

#include<iomanip>

#include<cmath>

#include<string>

#include<cstring>

#include<vector>

#include<list>

#include<algorithm>

#include<map>

#include<set>

#include<queue>

#include<stack>

using namespace std;

typedef long long ll;

#define fi first

#define se second

#define mp make_pair

#define mt make_tuple

#define pqueue priority_queue

const int inf=1e9+7;

const ll mod=1e9+7;

const ll mod1=998244353;

const ll big=1e18;

const double PI=2*asin(1);



int main() {

  int N;

  cin>>N;

  vector<tuple<ll, ll, ll> > arr(N);

  ll x, y, h;

  for(int i=0;i<N;++i) {

    cin>>x>>y>>h;

    arr[i] = mt(h, x, y);

  }

  sort(arr.begin(), arr.end(), greater<tuple<ll, ll, ll> >());

  ll Cx, Cy, H;

  ll tmpH;

  bool can=false;

  ll zero = 0;

  for(int i=0;i<=100;++i) {

    if(can) break;

    for(int j=0;j<=100;++j) {

      tmpH = get<0>(arr[0])+abs(get<1>(arr[0])-i)+abs(get<2>(arr[0])-j);

      can = true;

      for(int k=1;k<N;++k) {

        if(max(tmpH-abs(get<1>(arr[k])-i)-abs(get<2>(arr[k])-j), zero)!=get<0>(arr[k])) can = false;

      }

      if(can) {

        Cx = i;

        Cy = j;

        H = tmpH;

        break;

      }

    }

  }

  cout<<Cx<<" "<<Cy<<" "<<H<<endl;

}




// Fastest known solution for this problem:
// Original C++ solution (slower):
#define _CRT_SECURE_NO_WARNINGS

#define _USE_MATH_DEFINES

#include <bits/stdc++.h>

using namespace std;

#define rep(i,a,n) for (int i = a; i<n; i++)

#define per(i,a,n) for (int i = n-1; i>=a; i--)

#define pb push_back

#define mp make_pair

#define all(now) (now).begin(),(now).end()

#define fi first

#define se second

#define SZ(now) ((int)(now).size())

typedef vector<int> VI;

typedef long long ll;

typedef pair<int,int> PII;

const ll mod = 1000000007;

inline int read(int &n){char c=getchar();int x=0,f=1;while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}while(c>='0'&&c<='9'){x=x*10+(c-'0');c=getchar();}return n = x*f;}

ll powmod(ll a,ll b,ll mod) {ll res = 1; a%=mod; assert(b>=0); for(;b; b>>=1){if(b&1)res = res*a%mod; a = a*a%mod;}return res;}

ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

// head

const int N = 1e2+7;

int T,n,m;

VI X,Y,H;

int main()

{

    //ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);

    cin >> n;

    rep(i,0,n){

        int x, y, h;

        cin >> x >> y >> h;

        X.pb(x);

        Y.pb(y);

        H.pb(h);

    }

    rep(x,0,101){

        rep(y,0,101){

            int height = -1;

            bool flag = 0;

            rep(i,0,n){

                if(H[i]==0)

                    continue;

                if(height==-1)

                    height = H[i] + abs(X[i] - x) + abs(Y[i] - y);

                else if(height != H[i] + abs(X[i] - x) + abs(Y[i] - y))

                    flag = 1;

            }

            // rep(i,0,n){

            //     if(H[i]==0 && height-abs(X[i]-x)-(Y[i]-y) > 0)

            //         flag = 1;

            // }

            for(int i=0;i<n;i++){

				if(H[i]==0){

					if(height-abs(X[i]-x)-abs(Y[i]-y)>0)

						flag=1;

				}

			}

            if(!flag){

                // printf("%d %d %lld\n", i, j, height);

				cout<<x<<" "<<y<<" "<<height<<endl;

                return 0;

            }

        }

    }

    return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<algorithm>

using namespace std;

int n,a,b,f,x[101],h[101],y[101],cx,cy,H;

int main()

{

    scanf("%d",&n);

    for(int i=1; i<=n; ++i)

    {

        scanf("%d%d%d",&x[i],&y[i],&h[i]);

        if(h[i]!=0)

            f=i;

    }

    for(int xx=0; xx<=100; ++xx)

        for(int yy=0; yy<=100; ++yy)

        {

            cx=xx,cy=yy;

            H=h[f]+abs(x[f]-cx)+abs(y[f]-cy);

            for(int i=1; i<=n; ++i)

            {

                if(h[i]!=max(H-abs(x[i]-cx)-abs(y[i]-cy),0))

                    break;

                if(i==n)

                {

                    printf("%d %d %d",cx,cy,H);

                    return 0;

                }

            }

        }

}


// Fastest known solution for this problem: