stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include <iostream>

#include <algorithm>

#include <string>

using namespace std;

const int M=100;

int A[M+5][M+5];

int x[M+5],y[M+5],h[M+5];

bool check_h(int wh,int n,int a,int b)

{

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

	{

		if(h[i]&&(abs(x[i]-a)+abs(y[i]-b)+h[i]!=wh)) return 0;

		if(!h[i]&&(abs(x[i]-a)+abs(y[i]-b)<wh)) return 0;

	}

	return 1;

}

int main()

{

	int n;

	cin>>n;

	int f=0;

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

	{

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

		if(h[i]!=0) f=i;

	}

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

	{

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

		{

			int new_h=h[f]+abs(x[f]-i)+abs(y[f]-j);

			if(check_h(new_h,n,i,j))

			{

				cout<<i<<' '<<j<<' '<<new_h<<endl;

				return 0;

			}

		}

	}

	return 0;

}


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

#include<cstdlib>

#include<cstdio>

#define N 1001

using namespace std;

int n;

struct node {int x,y,h;}p[N];

int main()

{

	scanf("%d",&n);

	for(int i=1;i<=n;i++)scanf("%d%d%d",&p[i].x,&p[i].y,&p[i].h);

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

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

		{

			bool flag=1;int mn=2000000000,H=-1;

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

				if(p[i].h==0)mn=min(mn,abs(p[i].x-Cx)+abs(p[i].y-Cy));

				else if(H==-1)H=p[i].h+abs(p[i].x-Cx)+abs(p[i].y-Cy);

				else if(H!=p[i].h+abs(p[i].x-Cx)+abs(p[i].y-Cy))flag=0;

			if(!flag)continue;if(mn<H)continue;

			if(H==-1)H=mn; if(H<1)continue;

			printf("%d %d %d\n",Cx,Cy,H);exit(0);

		}

}
// Slower C++ solution:
///By Stephan Ramirez dsramirezc@unal.edu.co

#include<bits/stdc++.h>

#define ms(a,v) memset(a,v,sizeof a)

#define ll long long

#define N 101

using namespace std;

int n;

ll s[N][3];

int main(){

	#ifdef LOCAL

		freopen("in.txt","r",stdin);

		//freopen("out.txt","w",stdout);

	#endif

    scanf("%d",&n);

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

        scanf("%lld %lld %lld",&s[i][0],&s[i][1],&s[i][2]);

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

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

            set<ll> st;

            ll mx=1e10;

            bool flag=true;

            int ind=-1;

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

                if(s[k][2]>0){

                    ll h=s[k][2]+abs(i-s[k][0])+abs(j-s[k][1]);

                    ind=k;

                    st.insert(h);

                }else{

                    mx=min(mx,abs(i-s[k][0])+abs(j-s[k][1]));

                }

            }

            if(st.size()==1 && s[ind][2]+abs(i-s[ind][0])+abs(j-s[ind][1])>0 && s[ind][2]+abs(i-s[ind][0])+abs(j-s[ind][1])<=mx){

                cout<<i<<" "<<j<<" "<<s[ind][2]+abs(i-s[ind][0])+abs(j-s[ind][1])<<endl;

                return 0;

            }

        }

    }



	return 0;

}




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

int abs(int x) {

    return x > 0 ? x : -x;

}

int n, x[102], y[102], l[102], stdPoint, ansx, ansy, h;

bool check(){

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

        int t=h-abs(ansx-x[i])-abs(ansy-y[i]);

        if(t<0)t=0;

        if(l[i]!=t)return false;

    }

    return true;

}

int main() {

    scanf("%d", &n);

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

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

        if (l[i])

            stdPoint = i;

    }

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

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

            ansx = i, ansy = j;

            h = l[stdPoint] + abs(x[stdPoint] - i) + abs(y[stdPoint] - j);

            if (check()){

                printf("%d %d %d\n",ansx,ansy,h);

                return 0;

            }

        }

    }

    return 0;

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

#include <algorithm>

#include <string>

using namespace std;

const int M=100;

int A[M+5][M+5];

int x[M+5],y[M+5],h[M+5];

bool check_h(int wh,int n,int a,int b)

{

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

	{

		if(h[i]&&(abs(x[i]-a)+abs(y[i]-b)+h[i]!=wh)) return 0;

		if(!h[i]&&(abs(x[i]-a)+abs(y[i]-b)<wh)) return 0;

	}

	return 1;

}

int main()

{

	int n;

	cin>>n;

	int f=0;

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

	{

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

		if(h[i]!=0) f=i;

	}

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

	{

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

		{

			int new_h=h[f]+abs(x[f]-i)+abs(y[f]-j);

			if(check_h(new_h,n,i,j))

			{

				cout<<i<<' '<<j<<' '<<new_h<<endl;

				return 0;

			}

		}

	}

	return 0;

}


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

int abs(int x) {

    return x > 0 ? x : -x;

}

int n, x[102], y[102], l[102], stdPoint, ansx, ansy, h;

bool check(){

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

        int t=h-abs(ansx-x[i])-abs(ansy-y[i]);

        if(t<0)t=0;

        if(l[i]!=t)return false;

    }

    return true;

}

int main() {

    scanf("%d", &n);

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

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

        if (l[i])

            stdPoint = i;

    }

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

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

            ansx = i, ansy = j;

            h = l[stdPoint] + abs(x[stdPoint] - i) + abs(y[stdPoint] - j);

            if (check()){

                printf("%d %d %d\n",ansx,ansy,h);

                return 0;

            }

        }

    }

    return 0;

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

#include <cstring>

#include <cstdio>

#include <cmath>

#include <algorithm>

#include <vector>

using namespace std;

#define fir first

#define sec second

#define pb push_back

#define lowbit(x) ((x)&(-(x))) 



const int maxn = 106; 



int n, o; 

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



int Abs(int x) {

	return x>0?x:-x; 

}



int D(int x1, int y1, int x2, int y2) {

	return Abs(x1-x2)+Abs(y1-y2); 

}



bool check(int X, int Y) {

	int H = D(X,Y,x[o],y[o])+h[o];

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

		if (max(0,H-D(X,Y,x[i],y[i])) != h[i]) return false; 

	return true; 

} 



int main() {

	cin>>n; 

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

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

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

		if (h[i] != 0) o = i; 

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

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

			if (check(X, Y)) {

				cout<<X<<' '<<Y<<' '<<D(X,Y,x[o],y[o])+h[o]<<endl; 

				return 0; 

			}

}


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

int abs(int x) {

    return x > 0 ? x : -x;

}

int n, x[102], y[102], l[102], stdPoint, ansx, ansy, h;

bool check(){

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

        int t=h-abs(ansx-x[i])-abs(ansy-y[i]);

        if(t<0)t=0;

        if(l[i]!=t)return false;

    }

    return true;

}

int main() {

    scanf("%d", &n);

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

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

        if (l[i])

            stdPoint = i;

    }

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

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

            ansx = i, ansy = j;

            h = l[stdPoint] + abs(x[stdPoint] - i) + abs(y[stdPoint] - j);

            if (check()){

                printf("%d %d %d\n",ansx,ansy,h);

                return 0;

            }

        }

    }

    return 0;

}
// Slower C++ solution:
//wrong answer

#include<iostream>

#include<algorithm>



using namespace std;



int abs(int m, int n)

{

	return m - n > 0 ? m - n : n - m;

}



struct data {

	int x;

	int y;

	int h;

}d[105];



int main()

{

	int N, p=0;

	cin >> N;

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

	{

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

	}

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

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

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

		{

			int H = d[p].h + abs(d[p].x, i) + abs(d[p].y, j);

			int l = 0;

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

			{

				if (max(0, H - abs(d[k].x, i) - abs(d[k].y, j)) == d[k].h) l++;

			}

			//		cout<<i<<" "<<j<<" "<<H;

			//	cout<<"  *  "<<l<<"   &  "<<N<<endl;

			if (l == N) {

				cout << i << " " << j << " " << H << endl;

				return 0;

			}

		}

	return 0;

}

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

int abs(int x) {

    return x > 0 ? x : -x;

}

int n, x[102], y[102], l[102], stdPoint, ansx, ansy, h;

bool check(){

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

        int t=h-abs(ansx-x[i])-abs(ansy-y[i]);

        if(t<0)t=0;

        if(l[i]!=t)return false;

    }

    return true;

}

int main() {

    scanf("%d", &n);

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

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

        if (l[i])

            stdPoint = i;

    }

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

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

            ansx = i, ansy = j;

            h = l[stdPoint] + abs(x[stdPoint] - i) + abs(y[stdPoint] - j);

            if (check()){

                printf("%d %d %d\n",ansx,ansy,h);

                return 0;

            }

        }

    }

    return 0;

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

#include <cmath>



using namespace std;



int main()

{

    int N;

    cin >> N;

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



    int i;

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

    {

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

    }



    int j,k,H1,H2,p=0;

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

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

    {

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

    {

        H1 = abs(x[p]-i) + abs(y[p]-j) + h[p];

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

        {

            H2 = H1 - abs(x[k]-i) - abs(y[k]-j);

            if(H2 < 0) H2=0;

            if(H2!=h[k]) break;

        }

        if(k==N) {cout << i << ' ' << j << ' ' << H1;return 0;}

    }

    }



    return 0;

}

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

int abs(int x) {

    return x > 0 ? x : -x;

}

int n, x[102], y[102], l[102], stdPoint, ansx, ansy, h;

bool check(){

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

        int t=h-abs(ansx-x[i])-abs(ansy-y[i]);

        if(t<0)t=0;

        if(l[i]!=t)return false;

    }

    return true;

}

int main() {

    scanf("%d", &n);

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

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

        if (l[i])

            stdPoint = i;

    }

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

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

            ansx = i, ansy = j;

            h = l[stdPoint] + abs(x[stdPoint] - i) + abs(y[stdPoint] - j);

            if (check()){

                printf("%d %d %d\n",ansx,ansy,h);

                return 0;

            }

        }

    }

    return 0;

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

#include<string>

#include<cmath>

using namespace std;

int main(){

	int N;

	cin>>N;

	int a[3][N];

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

		cin>>a[0][n]>>a[1][n]>>a[2][n];

	}

	int q,w,e;

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

		if(a[2][m]!=0){

			q=a[0][m];

			w=a[1][m];

			e=a[2][m];

			break;

		}

	}

	int i,j,H,f,r;

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

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

			H=e+abs(i-q)+abs(j-w);

			r=0;

			for(f=0;f<N;f++){

				int h=H-abs(i-a[0][f])-abs(j-a[1][f]);

				if (h<0){

					h=0;	

				}

				if(a[2][f]!= h){

					r=1;

					break;

				}

			}

			if(r == 0){

				cout<<i<<' '<<j<<' '<<H<<endl;

			}

		}

	}

	return 0;

 } 

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

int abs(int x) {

    return x > 0 ? x : -x;

}

int n, x[102], y[102], l[102], stdPoint, ansx, ansy, h;

bool check(){

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

        int t=h-abs(ansx-x[i])-abs(ansy-y[i]);

        if(t<0)t=0;

        if(l[i]!=t)return false;

    }

    return true;

}

int main() {

    scanf("%d", &n);

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

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

        if (l[i])

            stdPoint = i;

    }

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

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

            ansx = i, ansy = j;

            h = l[stdPoint] + abs(x[stdPoint] - i) + abs(y[stdPoint] - j);

            if (check()){

                printf("%d %d %d\n",ansx,ansy,h);

                return 0;

            }

        }

    }

    return 0;

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

#include <cmath>

using namespace std;

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

int c_x,c_y,c_h;

int max_h;

int main()

{

	int n;

	scanf("%d",&n);

	max_h = -1;

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

	{

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

		max_h = max(max_h,h[i]);

	}

	int sign = 1;

	for(c_h = max_h;sign;c_h ++)

		for(c_x = 0;sign && c_x <= 100;c_x ++)

			for(c_y = 0;sign && c_y <= 100;c_y ++)

			{

				int i = 1;

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

					if(h[i] != max(0,(c_h - abs(c_x - x[i]) - abs(c_y - y[i]))))

						break;

				if(i > n)

					sign = 0;

			}

	printf("%d %d %d\n",c_x - 1,c_y - 1,c_h - 1);

	return 0;

}

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

int abs(int x) {

    return x > 0 ? x : -x;

}

int n, x[102], y[102], l[102], stdPoint, ansx, ansy, h;

bool check(){

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

        int t=h-abs(ansx-x[i])-abs(ansy-y[i]);

        if(t<0)t=0;

        if(l[i]!=t)return false;

    }

    return true;

}

int main() {

    scanf("%d", &n);

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

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

        if (l[i])

            stdPoint = i;

    }

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

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

            ansx = i, ansy = j;

            h = l[stdPoint] + abs(x[stdPoint] - i) + abs(y[stdPoint] - j);

            if (check()){

                printf("%d %d %d\n",ansx,ansy,h);

                return 0;

            }

        }

    }

    return 0;

}
// Slower C++ solution:
///By Stephan Ramirez dsramirezc@unal.edu.co

#include<bits/stdc++.h>

#define ms(a,v) memset(a,v,sizeof a)

#define ll long long

#define N 101

using namespace std;

int n;

ll s[N][3];

int main(){

	#ifdef LOCAL

		freopen("in.txt","r",stdin);

		//freopen("out.txt","w",stdout);

	#endif

    scanf("%d",&n);

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

        scanf("%lld %lld %lld",&s[i][0],&s[i][1],&s[i][2]);

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

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

            set<ll> st;

            ll mx=1e10;

            bool flag=true;

            int ind=-1;

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

                if(s[k][2]>0){

                    ll h=s[k][2]+abs(i-s[k][0])+abs(j-s[k][1]);

                    ind=k;

                    st.insert(h);

                }else{

                    mx=min(mx,abs(i-s[k][0])+abs(j-s[k][1]));

                }

            }

            if(st.size()==1 && s[ind][2]+abs(i-s[ind][0])+abs(j-s[ind][1])>0 && s[ind][2]+abs(i-s[ind][0])+abs(j-s[ind][1])<=mx){

                cout<<i<<" "<<j<<" "<<s[ind][2]+abs(i-s[ind][0])+abs(j-s[ind][1])<<endl;

                return 0;

            }

        }

    }



	return 0;

}




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

#include<algorithm>

#include<cmath>

#define ll long long

#define N 105

#define inf 0x3fffffff

#define rep(i, l, r) for(int i=l; i<=r; ++i)

using namespace std;

int n;

struct node{

    int x, y;

    ll h;

    void read(){scanf("%d%d%lld", &x, &y, &h);}

}a[N];

int main(){

    scanf("%d", &n);

    int pos=1;

    rep(i, 1, n){

        a[i].read();

        if(a[i].h) pos=i;

    }

    rep(cx, 0, 100){

        rep(cy, 0, 100){

            ll h=a[pos].h+abs(cx-a[pos].x)+abs(cy-a[pos].y);

            bool f=true;

            rep(i, 1, n){

                if(a[i].h!=max(h-abs(cx-a[i].x)-abs(cy-a[i].y), 0ll)) f=false;

            }

            if(f){

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

                return 0;

            }

        }

    }

    return 0;

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

#include <algorithm>

#include <string>

using namespace std;

const int M=100;

int A[M+5][M+5];

int x[M+5],y[M+5],h[M+5];

bool check_h(int wh,int n,int a,int b)

{

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

	{

		if(h[i]&&(abs(x[i]-a)+abs(y[i]-b)+h[i]!=wh)) return 0;

		if(!h[i]&&(abs(x[i]-a)+abs(y[i]-b)<wh)) return 0;

	}

	return 1;

}

int main()

{

	int n;

	cin>>n;

	int f=0;

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

	{

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

		if(h[i]!=0) f=i;

	}

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

	{

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

		{

			int new_h=h[f]+abs(x[f]-i)+abs(y[f]-j);

			if(check_h(new_h,n,i,j))

			{

				cout<<i<<' '<<j<<' '<<new_h<<endl;

				return 0;

			}

		}

	}

	return 0;

}


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

#include<algorithm>

#include<cmath>

#define ll long long

#define N 105

#define inf 0x3fffffff

#define rep(i, l, r) for(int i=l; i<=r; ++i)

using namespace std;

int n;

struct node{

    int x, y;

    ll h;

    void read(){scanf("%d%d%lld", &x, &y, &h);}

}a[N];

int main(){

    scanf("%d", &n);

    int pos=1;

    rep(i, 1, n){

        a[i].read();

        if(a[i].h) pos=i;

    }

    rep(cx, 0, 100){

        rep(cy, 0, 100){

            ll h=a[pos].h+abs(cx-a[pos].x)+abs(cy-a[pos].y);

            bool f=true;

            rep(i, 1, n){

                if(a[i].h!=max(h-abs(cx-a[i].x)-abs(cy-a[i].y), 0ll)) f=false;

            }

            if(f){

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

                return 0;

            }

        }

    }

    return 0;

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

#include <cstring>

#include <cstdio>

#include <cmath>

#include <algorithm>

#include <vector>

using namespace std;

#define fir first

#define sec second

#define pb push_back

#define lowbit(x) ((x)&(-(x))) 



const int maxn = 106; 



int n, o; 

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



int Abs(int x) {

	return x>0?x:-x; 

}



int D(int x1, int y1, int x2, int y2) {

	return Abs(x1-x2)+Abs(y1-y2); 

}



bool check(int X, int Y) {

	int H = D(X,Y,x[o],y[o])+h[o];

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

		if (max(0,H-D(X,Y,x[i],y[i])) != h[i]) return false; 

	return true; 

} 



int main() {

	cin>>n; 

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

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

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

		if (h[i] != 0) o = i; 

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

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

			if (check(X, Y)) {

				cout<<X<<' '<<Y<<' '<<D(X,Y,x[o],y[o])+h[o]<<endl; 

				return 0; 

			}

}


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

#include<algorithm>

#include<cmath>

#define ll long long

#define N 105

#define inf 0x3fffffff

#define rep(i, l, r) for(int i=l; i<=r; ++i)

using namespace std;

int n;

struct node{

    int x, y;

    ll h;

    void read(){scanf("%d%d%lld", &x, &y, &h);}

}a[N];

int main(){

    scanf("%d", &n);

    int pos=1;

    rep(i, 1, n){

        a[i].read();

        if(a[i].h) pos=i;

    }

    rep(cx, 0, 100){

        rep(cy, 0, 100){

            ll h=a[pos].h+abs(cx-a[pos].x)+abs(cy-a[pos].y);

            bool f=true;

            rep(i, 1, n){

                if(a[i].h!=max(h-abs(cx-a[i].x)-abs(cy-a[i].y), 0ll)) f=false;

            }

            if(f){

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

                return 0;

            }

        }

    }

    return 0;

}
// Slower C++ solution:
//wrong answer

#include<iostream>

#include<algorithm>



using namespace std;



int abs(int m, int n)

{

	return m - n > 0 ? m - n : n - m;

}



struct data {

	int x;

	int y;

	int h;

}d[105];



int main()

{

	int N, p=0;

	cin >> N;

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

	{

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

	}

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

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

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

		{

			int H = d[p].h + abs(d[p].x, i) + abs(d[p].y, j);

			int l = 0;

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

			{

				if (max(0, H - abs(d[k].x, i) - abs(d[k].y, j)) == d[k].h) l++;

			}

			//		cout<<i<<" "<<j<<" "<<H;

			//	cout<<"  *  "<<l<<"   &  "<<N<<endl;

			if (l == N) {

				cout << i << " " << j << " " << H << endl;

				return 0;

			}

		}

	return 0;

}

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

#include<algorithm>

#include<cmath>

#define ll long long

#define N 105

#define inf 0x3fffffff

#define rep(i, l, r) for(int i=l; i<=r; ++i)

using namespace std;

int n;

struct node{

    int x, y;

    ll h;

    void read(){scanf("%d%d%lld", &x, &y, &h);}

}a[N];

int main(){

    scanf("%d", &n);

    int pos=1;

    rep(i, 1, n){

        a[i].read();

        if(a[i].h) pos=i;

    }

    rep(cx, 0, 100){

        rep(cy, 0, 100){

            ll h=a[pos].h+abs(cx-a[pos].x)+abs(cy-a[pos].y);

            bool f=true;

            rep(i, 1, n){

                if(a[i].h!=max(h-abs(cx-a[i].x)-abs(cy-a[i].y), 0ll)) f=false;

            }

            if(f){

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

                return 0;

            }

        }

    }

    return 0;

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

#include <cmath>



using namespace std;



int main()

{

    int N;

    cin >> N;

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



    int i;

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

    {

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

    }



    int j,k,H1,H2,p=0;

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

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

    {

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

    {

        H1 = abs(x[p]-i) + abs(y[p]-j) + h[p];

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

        {

            H2 = H1 - abs(x[k]-i) - abs(y[k]-j);

            if(H2 < 0) H2=0;

            if(H2!=h[k]) break;

        }

        if(k==N) {cout << i << ' ' << j << ' ' << H1;return 0;}

    }

    }



    return 0;

}

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

#include<algorithm>

#include<cmath>

#define ll long long

#define N 105

#define inf 0x3fffffff

#define rep(i, l, r) for(int i=l; i<=r; ++i)

using namespace std;

int n;

struct node{

    int x, y;

    ll h;

    void read(){scanf("%d%d%lld", &x, &y, &h);}

}a[N];

int main(){

    scanf("%d", &n);

    int pos=1;

    rep(i, 1, n){

        a[i].read();

        if(a[i].h) pos=i;

    }

    rep(cx, 0, 100){

        rep(cy, 0, 100){

            ll h=a[pos].h+abs(cx-a[pos].x)+abs(cy-a[pos].y);

            bool f=true;

            rep(i, 1, n){

                if(a[i].h!=max(h-abs(cx-a[i].x)-abs(cy-a[i].y), 0ll)) f=false;

            }

            if(f){

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

                return 0;

            }

        }

    }

    return 0;

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

#include<string>

#include<cmath>

using namespace std;

int main(){

	int N;

	cin>>N;

	int a[3][N];

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

		cin>>a[0][n]>>a[1][n]>>a[2][n];

	}

	int q,w,e;

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

		if(a[2][m]!=0){

			q=a[0][m];

			w=a[1][m];

			e=a[2][m];

			break;

		}

	}

	int i,j,H,f,r;

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

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

			H=e+abs(i-q)+abs(j-w);

			r=0;

			for(f=0;f<N;f++){

				int h=H-abs(i-a[0][f])-abs(j-a[1][f]);

				if (h<0){

					h=0;	

				}

				if(a[2][f]!= h){

					r=1;

					break;

				}

			}

			if(r == 0){

				cout<<i<<' '<<j<<' '<<H<<endl;

			}

		}

	}

	return 0;

 } 

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

#include<algorithm>

#include<cmath>

#define ll long long

#define N 105

#define inf 0x3fffffff

#define rep(i, l, r) for(int i=l; i<=r; ++i)

using namespace std;

int n;

struct node{

    int x, y;

    ll h;

    void read(){scanf("%d%d%lld", &x, &y, &h);}

}a[N];

int main(){

    scanf("%d", &n);

    int pos=1;

    rep(i, 1, n){

        a[i].read();

        if(a[i].h) pos=i;

    }

    rep(cx, 0, 100){

        rep(cy, 0, 100){

            ll h=a[pos].h+abs(cx-a[pos].x)+abs(cy-a[pos].y);

            bool f=true;

            rep(i, 1, n){

                if(a[i].h!=max(h-abs(cx-a[i].x)-abs(cy-a[i].y), 0ll)) f=false;

            }

            if(f){

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

                return 0;

            }

        }

    }

    return 0;

}