stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 2.1761916656813183x):
#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;

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 2.1156533332969314x):
#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;

}
// Slower C++ solution:
#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;

}




// Faster C++ solution for the same problem (measured speedup: 1.135074236228472x):
#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;

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 5.200811537256281x):
#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;

                }

            }

        }

}
// Slower C++ solution:
#include<iostream>

#include<cmath>

#include<cstdlib>

using namespace std;

struct coo{

	int x;

	int y;

	int h;

}c[110];

int main()

{

	int n;

	cin>>n;

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

	{

		cin>>c[i].x;

		cin>>c[i].y;

		cin>>c[i].h;

	}

	int ch;

	int p=0;

	while(c[p].h==0) p++;

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

	{

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

		{

			int ch=c[p].h+abs(i-c[p].x)+abs(j-c[p].y);

			int f=0;

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

			{

				int hh=ch-abs(i-c[k].x)-abs(j-c[k].y);

				if(hh<0) hh=0;

				if(hh!=c[k].h)

				{

					f=1;

					break;

				}

			}

			if(!f)

			{

				cout<<i<<' '<<j<<' '<<ch<<endl; return 0;

			} 

		}

	}

} 




// Faster C++ solution for the same problem (measured speedup: 5.129852739463465x):
#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;

                }

            }

        }

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 4.993413956750812x):
#include<cstdio>

using namespace std;

inline int abs(int x){

	return x<0?-x:x;

}

inline int max(int x,int y){

	return x>y?x:y;

}

int n,a,b,c;

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

int main(){

	scanf("%d",&n);

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

		scanf("%d%d%d",x+i,y+i,h+i);

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

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

			c=h[0]+abs(a-x[0])+abs(b-y[0]);

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

				if(c>(h[i]+abs(a-x[i])+abs(b-y[i])))

					c=h[i]+abs(a-x[i])+abs(b-y[i]);

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

				if(h[i]!=max(0,c-abs(a-x[i])-abs(b-y[i]))){

					c=-1;break;

				} 

			if(c==-1)continue;

			printf("%d %d %d",a,b,c);

			return 0;

		}

	}

	return 0;

}
// Slower C++ solution:
#include<iostream>

#include<cmath>

#include<cstdlib>

using namespace std;

struct coo{

	int x;

	int y;

	int h;

}c[110];

int main()

{

	int n;

	cin>>n;

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

	{

		cin>>c[i].x;

		cin>>c[i].y;

		cin>>c[i].h;

	}

	int ch;

	int p=0;

	while(c[p].h==0) p++;

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

	{

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

		{

			int ch=c[p].h+abs(i-c[p].x)+abs(j-c[p].y);

			int f=0;

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

			{

				int hh=ch-abs(i-c[k].x)-abs(j-c[k].y);

				if(hh<0) hh=0;

				if(hh!=c[k].h)

				{

					f=1;

					break;

				}

			}

			if(!f)

			{

				cout<<i<<' '<<j<<' '<<ch<<endl; return 0;

			} 

		}

	}

} 




// Faster C++ solution for the same problem (measured speedup: 4.92528484868476x):
#include<cstdio>

using namespace std;

inline int abs(int x){

	return x<0?-x:x;

}

inline int max(int x,int y){

	return x>y?x:y;

}

int n,a,b,c;

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

int main(){

	scanf("%d",&n);

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

		scanf("%d%d%d",x+i,y+i,h+i);

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

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

			c=h[0]+abs(a-x[0])+abs(b-y[0]);

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

				if(c>(h[i]+abs(a-x[i])+abs(b-y[i])))

					c=h[i]+abs(a-x[i])+abs(b-y[i]);

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

				if(h[i]!=max(0,c-abs(a-x[i])-abs(b-y[i]))){

					c=-1;break;

				} 

			if(c==-1)continue;

			printf("%d %d %d",a,b,c);

			return 0;

		}

	}

	return 0;

}
// Slower C++ solution:
#include <cstdio>

#include <iostream>

#include <algorithm>

#include <cstdlib>

#include <cstring>

#include <cassert>

#include <string>

using namespace std;



int N;

int X[110], Y[110], H[110];

bool flag;



int main(){

	cin >> N;

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

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

	flag = false;

	for (int x = 0; x <= 100 && !flag; x++)

		for (int y = 0; y <= 100 && !flag; y++){

			int h = 0;

			flag = true;

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

				if (H[i] > 0){

					if (h == 0)

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

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

						flag = false;

				}

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

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

					flag = false;

			if (h == 0)

				flag = false;

			if (flag)

				printf("%d %d %d\n", x, y, h);

		}

	assert(flag);

}

// Faster C++ solution for the same problem (measured speedup: 4.998892685173574x):
#include<cstdio>

using namespace std;

inline int abs(int x){

	return x<0?-x:x;

}

inline int max(int x,int y){

	return x>y?x:y;

}

int n,a,b,c;

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

int main(){

	scanf("%d",&n);

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

		scanf("%d%d%d",x+i,y+i,h+i);

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

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

			c=h[0]+abs(a-x[0])+abs(b-y[0]);

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

				if(c>(h[i]+abs(a-x[i])+abs(b-y[i])))

					c=h[i]+abs(a-x[i])+abs(b-y[i]);

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

				if(h[i]!=max(0,c-abs(a-x[i])-abs(b-y[i]))){

					c=-1;break;

				} 

			if(c==-1)continue;

			printf("%d %d %d",a,b,c);

			return 0;

		}

	}

	return 0;

}
// Slower C++ solution:
#include<iostream>

#include<cmath>

#include<cstdlib>

using namespace std;

struct coo{

	int x;

	int y;

	int h;

}c[110];

int main()

{

	int n;

	cin>>n;

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

	{

		cin>>c[i].x;

		cin>>c[i].y;

		cin>>c[i].h;

	}

	int ch;

	int p=0;

	while(c[p].h==0) p++;

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

	{

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

		{

			int ch=c[p].h+abs(i-c[p].x)+abs(j-c[p].y);

			int f=0;

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

			{

				int hh=ch-abs(i-c[k].x)-abs(j-c[k].y);

				if(hh<0) hh=0;

				if(hh!=c[k].h)

				{

					f=1;

					break;

				}

			}

			if(!f)

			{

				cout<<i<<' '<<j<<' '<<ch<<endl; return 0;

			} 

		}

	}

} 




// Faster C++ solution for the same problem (measured speedup: 4.979643353881385x):
//Acknowledgement:  Xiaoyu Han, for his "brute-force" proposal



#include <cstdio>

#include <algorithm>

#include <cstdlib>



using std::max;  using std::abs;

using std::min;



const int MAXN=105;



int N,cx,cy,ch=0,c_point,min_abs;                     //c_point: calculable point

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



int main()

{

    scanf("%d",&N);

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

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

    for (cx=0;cx<=100&&ch<=0;++cx)

    {

        for (cy=0;cy<=100&&ch<=0;++cy)

        {

            min_abs=MAXN<<1;

            for (c_point=1;c_point<=N&&h[c_point]==0;++c_point);

            if (c_point==N+1)

            {

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

                    min_abs=min(min_abs,abs(x[i]-cx)+abs(y[i]-cy));

                if (min_abs==1) ch=1;

            }

            else

            {

                ch=h[c_point]+abs(x[c_point]-cx)+abs(y[c_point]-cy);

                int i;

                for (i=1;i<=N&&h[i]==max(ch-abs(x[i]-cx)-abs(y[i]-cy),0);++i);

                if (i<=N) ch=0;

            }

        }

    }

    printf("%d %d %d",--cx,--cy,ch);



    return 0;

}
// Slower C++ solution:
#include <cstdio>

#include <iostream>

#include <algorithm>

#include <cstdlib>

#include <cstring>

#include <cassert>

#include <string>

using namespace std;



int N;

int X[110], Y[110], H[110];

bool flag;



int main(){

	cin >> N;

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

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

	flag = false;

	for (int x = 0; x <= 100 && !flag; x++)

		for (int y = 0; y <= 100 && !flag; y++){

			int h = 0;

			flag = true;

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

				if (H[i] > 0){

					if (h == 0)

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

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

						flag = false;

				}

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

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

					flag = false;

			if (h == 0)

				flag = false;

			if (flag)

				printf("%d %d %d\n", x, y, h);

		}

	assert(flag);

}

// Faster C++ solution for the same problem (measured speedup: 5.054063572209061x):
//Acknowledgement:  Xiaoyu Han, for his "brute-force" proposal



#include <cstdio>

#include <algorithm>

#include <cstdlib>



using std::max;  using std::abs;

using std::min;



const int MAXN=105;



int N,cx,cy,ch=0,c_point,min_abs;                     //c_point: calculable point

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



int main()

{

    scanf("%d",&N);

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

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

    for (cx=0;cx<=100&&ch<=0;++cx)

    {

        for (cy=0;cy<=100&&ch<=0;++cy)

        {

            min_abs=MAXN<<1;

            for (c_point=1;c_point<=N&&h[c_point]==0;++c_point);

            if (c_point==N+1)

            {

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

                    min_abs=min(min_abs,abs(x[i]-cx)+abs(y[i]-cy));

                if (min_abs==1) ch=1;

            }

            else

            {

                ch=h[c_point]+abs(x[c_point]-cx)+abs(y[c_point]-cy);

                int i;

                for (i=1;i<=N&&h[i]==max(ch-abs(x[i]-cx)-abs(y[i]-cy),0);++i);

                if (i<=N) ch=0;

            }

        }

    }

    printf("%d %d %d",--cx,--cy,ch);



    return 0;

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 5.094827183364358x):
//Acknowledgement:  Xiaoyu Han, for his "brute-force" proposal



#include <cstdio>

#include <algorithm>

#include <cstdlib>



using std::max;  using std::abs;

using std::min;



const int MAXN=105;



int N,cx,cy,ch=0,c_point,min_abs;                     //c_point: calculable point

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



int main()

{

    scanf("%d",&N);

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

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

    for (cx=0;cx<=100&&ch<=0;++cx)

    {

        for (cy=0;cy<=100&&ch<=0;++cy)

        {

            min_abs=MAXN<<1;

            for (c_point=1;c_point<=N&&h[c_point]==0;++c_point);

            ch=h[c_point]+abs(x[c_point]-cx)+abs(y[c_point]-cy);

            int i;

            for (i=1;i<=N&&h[i]==max(ch-abs(x[i]-cx)-abs(y[i]-cy),0);++i);

            if (i<=N) ch=0;

        }

    }

    printf("%d %d %d",--cx,--cy,ch);



    return 0;

}