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

#include <vector>

#include <tuple>

using namespace std;



int p_count;

vector<tuple<int, int, int>> pyramid;

vector<tuple<int, int, int>> measure;



void init_pyramid()

{

  p_count = 101 * 101;

  for (auto y = 0; y <= 100; y++) {

    for (auto x = 0; x <= 100; x++) {

      pyramid.emplace_back(make_tuple(x, y, 0));

    }

  }

}



void read_measure_data()

{

  int n;

  cin >> n;

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

    int a, b, c;

    cin >> a >> b >> c;

    measure.emplace_back(make_tuple(a, b, c));

  }

}



void check1()

{

  for (auto&& m : measure) {

    for (auto&& p : pyramid) {

      if (get<2>(p) < 0) continue;

      if (get<2>(m) == 0) continue;

      int guess = get<2>(m) + abs(get<0>(p) - get<0>(m)) + abs(get<1>(p) - get<1>(m));

      if (get<2>(p) == 0) {

	get<2>(p) = guess;

      } else if (get<2>(p) != guess) {

	get<2>(p) = -1;

	p_count--;

	if (p_count <= 1) return;

      }

    }

  }

}



void check2()

{

  if (p_count <= 1) return;

  for (auto&& m : measure) {

    for (auto&& p : pyramid) {

      if (get<2>(p) < 0) continue;

      if (get<2>(m) != 0) continue;

      int guess = abs(get<0>(p) - get<0>(m)) + abs(get<1>(p) - get<1>(m));

      if (guess - get<2>(p) < 0) {

	get<2>(p) = -1;

	if (p_count <= 1) return;

      }

    }

  }

}



void print_ans()

{

  for (auto&& p : pyramid) {

    if (get<2>(p) > 0) {

      cout << get<0>(p) << " " << get<1>(p) << " " << get<2>(p) << endl;

    }

  }

}



int main()

{

  init_pyramid();

  read_measure_data();

  check1();

  check2();

  print_ans();

}


// Faster C++ solution for the same problem (measured speedup: 1.1798606307853974x):
#include <bits/stdc++.h>

using namespace std;



struct xyh {

  int x, y, h;

};



int main()

{

  int n;

  cin >> n;

  vector<xyh> survey(n);



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

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

  }



  vector<xyh> pyramid(101 * 101);



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

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

      pyramid[101 * y + x] = {x, y, 0};

    }

  }



  for (auto&& p : pyramid) {

    if (p.h < 0) continue;

    for (auto&& s : survey) {

      if (s.h == 0) continue;

      if (p.h == 0) {

        p.h = abs(p.x - s.x) + abs(p.y - s.y) + s.h;

      } else {

        if (p.h != abs(p.x - s.x) + abs(p.y - s.y) + s.h) {

          p.h = -1;

          break;

        }

      }

    }

    if (p.h < 0) continue;

    for (auto&& s : survey) {

      if (s.h != 0) continue;

      if (p.h > abs(p.x - s.x) + abs(p.y - s.y)) {

        p.h = -1;

        break;

      }

    }

  }

  for (auto&& p : pyramid) {

    if (p.h > 0) {

      cout << p.x << " " << p.y << " " << p.h << endl;

      break;

    }

  }

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

#include <vector>

#include <tuple>

using namespace std;



int p_count;

vector<tuple<int, int, int>> pyramid;

vector<tuple<int, int, int>> measure;



void init_pyramid()

{

  p_count = 101 * 101;

  for (auto y = 0; y <= 100; y++) {

    for (auto x = 0; x <= 100; x++) {

      pyramid.emplace_back(make_tuple(x, y, 0));

    }

  }

}



void read_measure_data()

{

  int n;

  cin >> n;

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

    int a, b, c;

    cin >> a >> b >> c;

    measure.emplace_back(make_tuple(a, b, c));

  }

}



void check1()

{

  for (auto&& m : measure) {

    for (auto&& p : pyramid) {

      if (get<2>(p) < 0) continue;

      if (get<2>(m) == 0) continue;

      int guess = get<2>(m) + abs(get<0>(p) - get<0>(m)) + abs(get<1>(p) - get<1>(m));

      if (get<2>(p) == 0) {

	get<2>(p) = guess;

      } else if (get<2>(p) != guess) {

	get<2>(p) = -1;

	if (--p_count <= 1) return;

      }

    }

  }

}



void check2()

{

  for (auto&& m : measure) {

    for (auto&& p : pyramid) {

      if (get<2>(p) < 0) continue;

      if (get<2>(m) != 0) continue;

      int guess = abs(get<0>(p) - get<0>(m)) + abs(get<1>(p) - get<1>(m));

      if (guess - get<2>(p) < 0) {

	get<2>(p) = -1;

	if (--p_count <= 1) return;

      }

    }

  }

}



void print_ans()

{

  for (auto&& p : pyramid) {

    if (get<2>(p) > 0) {

      cout << get<0>(p) << " " << get<1>(p) << " " << get<2>(p) << endl;

    }

  }

}



int main()

{

  init_pyramid();

  read_measure_data();

  check1();

  check2();

  print_ans();

}


// Faster C++ solution for the same problem (measured speedup: 1.2033121006755938x):
#include <bits/stdc++.h>

using namespace std;



struct xyh {

  int x, y, h;

};



int main()

{

  int n;

  cin >> n;

  vector<xyh> survey(n);



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

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

  }



  vector<xyh> pyramid(101 * 101);



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

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

      pyramid[101 * y + x] = {x, y, 0};

    }

  }



  for (auto&& p : pyramid) {

    if (p.h < 0) continue;

    for (auto&& s : survey) {

      if (s.h == 0) continue;

      if (p.h == 0) {

        p.h = abs(p.x - s.x) + abs(p.y - s.y) + s.h;

      } else {

        if (p.h != abs(p.x - s.x) + abs(p.y - s.y) + s.h) {

          p.h = -1;

          break;

        }

      }

    }

    if (p.h < 0) continue;

    for (auto&& s : survey) {

      if (s.h != 0) continue;

      if (p.h > abs(p.x - s.x) + abs(p.y - s.y)) {

        p.h = -1;

        break;

      }

    }

  }

  for (auto&& p : pyramid) {

    if (p.h > 0) {

      cout << p.x << " " << p.y << " " << p.h << endl;

      break;

    }

  }

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

#include <cstring>

#include <cmath>

#include <iostream> 

using namespace std;



const int NN = 1100;

struct rec1{

	int x, y, h;

}a[NN];

int h, n, tmp;

bool f;



int max(int a, int b){

	if (a > b) return a;

	else return b;

}



int main(){

	

	scanf("%d", &n);

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

	

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

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

			

			tmp = 1;

			while (a[tmp].h == 0) tmp++;

			h = a[tmp].h + abs(i - a[tmp].x) + abs(j - a[tmp].y);

			

			f = true;

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

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

					f = false;

					break;

				}

			if (f){

				printf("%d %d %d\n", i, j, h);

				return 0;

			}

		}

	}

} 

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

#include <cstring>

#include <algorithm>

using namespace std;

#define N 101



int n, H[N][N], Lim[N][N];



int main()

{

	scanf("%d", &n);

	memset(Lim, 0x3f, sizeof(Lim));

	for (int t = 1, x, y, h; t <= n; t ++)

	{

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

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

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

			{

				int t = h + abs(i - x) + abs(j - y);

				if (h == 0)

					Lim[i][j] = min(Lim[i][j], t);

				else

				{

					if (!H[i][j] || H[i][j] == t)

						H[i][j] = t;

					else H[i][j] = -1;

				}

			}

	}

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

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

			if (H[i][j] > 0 && H[i][j] <= Lim[i][j])

				printf("%d %d %d\n", i, j, H[i][j]);

	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: 3.12793149685663x):
#include <cstdio>

#include <cstring>

#include <algorithm>

using namespace std;

#define N 101



int n, H[N][N], Lim[N][N];



int main()

{

	scanf("%d", &n);

	memset(Lim, 0x3f, sizeof(Lim));

	for (int t = 1, x, y, h; t <= n; t ++)

	{

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

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

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

			{

				int t = h + abs(i - x) + abs(j - y);

				if (h == 0)

					Lim[i][j] = min(Lim[i][j], t);

				else

				{

					if (!H[i][j] || H[i][j] == t)

						H[i][j] = t;

					else H[i][j] = -1;

				}

			}

	}

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

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

			if (H[i][j] > 0 && H[i][j] <= Lim[i][j])

				printf("%d %d %d\n", i, j, H[i][j]);

	return 0;

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

#include<cstdio>

using namespace std;

const int N = 105;

struct info{

    int x, y, h;

}a[N];

template<class T>T Abs(T x){

    return x < 0 ? -x : x;

}

int main(){

    int n,t; cin >> n;

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

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

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

    }

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

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

            int h = a[t].h + Abs(a[t].x - i) + Abs(a[t].y - j);

            bool flag = 1;

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

                flag &= max(0, h - Abs(a[k].x - i) - Abs(a[k].y - j)) == a[k].h;

            if(flag)return cout << i << " " << j << " " << h << endl, 0;

        }

    return 0;

}


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

#include <cstring>

#include <algorithm>

using namespace std;

#define N 101



int n, H[N][N], Lim[N][N];



int main()

{

	scanf("%d", &n);

	memset(Lim, 0x3f, sizeof(Lim));

	for (int t = 1, x, y, h; t <= n; t ++)

	{

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

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

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

			{

				int t = h + abs(i - x) + abs(j - y);

				if (h == 0)

					Lim[i][j] = min(Lim[i][j], t);

				else

				{

					if (!H[i][j] || H[i][j] == t)

						H[i][j] = t;

					else H[i][j] = -1;

				}

			}

	}

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

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

			if (H[i][j] > 0 && H[i][j] <= Lim[i][j])

				printf("%d %d %d\n", i, j, H[i][j]);

	return 0;

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

}

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

#include <algorithm>

#include <tuple>

//#include <string>

#include <vector>

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

#define ll long long

using namespace std;



int H;

int N;

vector<vector<int>> v;

int ansx, ansy, ansh;



int main() {

	cin >> N;

	rep(i, N) {

		int x, y, h;

      	cin >>x >>y >>h;

		v.push_back({h,x,y});

	}



	sort(v.rbegin(), v.rend());

	/*/

  	rep(i,N){

    cout <<v[i][0] <<" "<<v[i][1] <<" " <<v[i][2] <<endl;

    }

    //*/

      

	bool flag = 1;

	rep(i, 101) {

		rep(j, 101) {

			ansh = v[0][0] + abs(i - v[0][1]) + abs(j - v[0][2]);

			rep(k, N) {

				if (v[k][0] != max(ansh- abs(i - v[k][1]) - abs(j - v[k][2]),0)){

                  	flag = 0;

					break;

                }

			}

			

			if (flag) { 

				ansx = i; ansy = j; 

				cout << ansx << " " << ansy << " " << ansh << endl;

				return 0;

			}

          

          	flag=1;

		}

	}





	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;



int main() {



	ll n; cin >> n;

	vector<ll> vx(n), vy(n), vh(n);

	ll hPositiveIndex;

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

		cin >> vx[i] >> vy[i] >> vh[i];

		if (0 < vh[i]) hPositiveIndex = i;

	}

	const ll p = 100;

	ll resx = -1;

	ll resy = -1;

	ll resh = -1;

	for (ll x = 0; x <= p; x++) {

		for (ll y = 0; y <= p; y++) {			

			ll h = vh[hPositiveIndex] + abs(vx[hPositiveIndex] - x) + abs(vy[hPositiveIndex] - y);

			bool ok = true;

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

				if (0 < vh[i] && vh[i] != h - abs(vx[i] - x) - abs(vy[i] - y)) ok = false;

				if (vh[i] == 0 && h > abs(vx[i] - x) + abs(vy[i] - y)) ok = false;

			}

			if (ok) {

				resx = x;

				resy = y;

				resh = h;

			}

		}

	}

	cout << resx << " " << resy << " " << resh << endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.1187066111576824x):
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;



int main() {



	ll n; cin >> n;

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

	ll index;

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

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

		if (0 < h[i]) index = i;

	}

	const ll p = 100;

	ll ansCx, ansCy, ansH;

	for (ll cx = 0; cx <= p; cx++) {

		for (ll cy = 0; cy <= p; cy++) {

			ll ansH = h[index] + abs(x[index] - cx) + abs(y[index] - cy);

			bool ok = true;

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

				if (0 < h[i] &&  h[i] != ansH - abs(x[i] - cx) - abs(y[i] - cy)) {

					ok = false;

				}

				if (0 == h[i] && h[i] < ansH - abs(x[i] - cx) - abs(y[i] - cy)) {

					ok = false;

				}

			}

			if (ok) {

				ansCx = cx;

				ansCy = cy;

				cout << ansCx << " " << ansCy << " " << ansH << endl;

				return 0;				

			}

		}

	}	

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>



using namespace std;



int main() {

    int n;

    cin >> n;

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

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

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

    }



    int pos = 0;

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

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

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

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

            bool ok = true;

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

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

                    ok = false;

            }

            if (ok) {

                cout << cx << ' ' << cy << ' ' << H << endl;

                return 0;

            }

        }

    }

}


// Faster C++ solution for the same problem (measured speedup: 5.206186953056116x):


#include<cstdio>

#include<algorithm>

int n,a,b,u,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)u=i;

    }

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

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

        {

            cx=xi,cy=yi;

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

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

            {

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

                if(i==n)

                {

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

                    return 0;

                }

            }

        }

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

}


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

#include <vector>

#include <algorithm>

#include <map>

#include <set>

#include <cmath>

#include <cstring>

#include <iomanip>

#include <random>

#include <chrono>

#include <queue>

using namespace std;

typedef long long ll;

typedef pair<int, int> PII;

typedef pair<ll, ll> PLL;

#define INF 1000000000

#define MOD 1000000007



int main(){

    int N; cin >> N;

    vector<vector<int>> T(N, vector<int>(3));

    vector<int> smp(3);

    

    for(vector<int> &t:T){

        cin >> t[0] >> t[1] >> t[2];

        if(t[2]!=0)

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

                smp[i] = t[i];

    }



    vector<vector<int>> o;

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

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

            int H = smp[2] + abs(smp[0]-i) + abs(smp[1]-j);

            bool f = true;

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

                int h = max(H - abs(i-T[k][0]) - abs(j-T[k][1]), 0);

                if(h!=T[k][2]) f = false;

            }

            if(f){

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

                return 0;

            }

        }

    }

    return 0;

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

#include <vector>

#include <algorithm>

#include <map>

#include <set>

#include <cmath>

#include <cstring>

#include <iomanip>

#include <random>

#include <chrono>

#include <queue>

using namespace std;

typedef long long ll;

typedef pair<int, int> PII;

typedef pair<ll, ll> PLL;

#define INF 1000000000

#define MOD 1000000007



int main(){

    int N; cin >> N;

    vector<vector<int>> T(N, vector<int>(3));



    for(vector<int> &t:T)

        cin >> t[0] >> t[1] >> t[2];



    map<int, int> M;

    vector<vector<int>> o;

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

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

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

                if(T[k][2]==0) continue;

                M[T[k][2]+abs(i-T[k][0])+abs(j-T[k][1])]++;

            }

            if(M.size()==1) o.push_back({i, j, M.begin()->first});

            M.clear();

        }

    }

    

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

        bool f = true;

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

            if(T[j][2]==0 && max(0, o[i][2] - abs(o[i][0]-T[j][0]) - abs(o[i][1]-T[j][1]))!=0) f = false;

        }

        if(f) cout << o[i][0] << " " << o[i][1] << " " << o[i][2] << endl;

    }

    return 0;

}


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

#include <vector>

#include <algorithm>

#include <map>

#include <set>

#include <cmath>

#include <cstring>

#include <iomanip>

#include <random>

#include <chrono>

#include <queue>

using namespace std;

typedef long long ll;

typedef pair<int, int> PII;

typedef pair<ll, ll> PLL;

#define INF 1000000000

#define MOD 1000000007



int main(){

    int N; cin >> N;

    vector<vector<int>> T(N, vector<int>(3));

    vector<int> smp(3);

    

    for(vector<int> &t:T){

        cin >> t[0] >> t[1] >> t[2];

        if(t[2]!=0)

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

                smp[i] = t[i];

    }



    vector<vector<int>> o;

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

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

            int H = smp[2] + abs(smp[0]-i) + abs(smp[1]-j);

            bool f = true;

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

                int h = max(H - abs(i-T[k][0]) - abs(j-T[k][1]), 0);

                if(h!=T[k][2]) f = false;

            }

            if(f){

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

                return 0;

            }

        }

    }

    return 0;

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

#include<string>

#include<algorithm>

#include<vector>

#include<iomanip>

#include<math.h>

#include<complex>

#include<queue>

#include<deque>

#include<stack>

#include<map>

#include<set>

#include<bitset>

#include<functional>

using namespace std;

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

#define rep(i,n) REP(i,0,n)

typedef long long ll;

typedef pair<int,int> pint;

typedef pair<ll,int> pli;

const int inf=1e9+7;

const ll longinf=1LL<<60 ;

const ll mod=1e9+7 ;



int main(){

    int n;

    cin>>n;

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

    rep(i,n)cin>>x[i]>>y[i]>>h[i];

    rep(i,101)rep(j,101){

        int ok=true;

        int H=0;

        rep(k,n){

            if(h[k]!=0)H=h[k]+abs(x[k]-i)+abs(y[k]-j);

        }

        rep(k,n){

            if(max(H-abs(x[k]-i)-abs(y[k]-j),0)!=h[k])ok=false;

        }

        if(ok)cout<<i<<" "<<j<<" "<<H<<endl;

    }

    return 0;

}


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

#include<string>

#include<algorithm>

#include<vector>

#include<iomanip>

#include<math.h>

#include<complex>

#include<queue>

#include<deque>

#include<stack>

#include<map>

#include<set>

#include<bitset>

#include<functional>

using namespace std;

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

#define rep(i,n) REP(i,0,n)

typedef long long ll;

typedef pair<int,int> pint;

typedef pair<ll,int> pli;

const int inf=1e9+7;

const ll longinf=1LL<<60 ;

const ll mod=1e9+7 ;



int main(){

    int n;

    cin>>n;

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

    rep(i,n)cin>>x[i]>>y[i]>>h[i];

    rep(i,101)rep(j,101){

        int ok=true;

        int H=0;

        rep(k,n){

            if(h[k]!=0){

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

              break;

            }

        }

        rep(k,n){

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

              ok=false;

              break;

            }

        }

        if(ok){

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

          return 0;

        }

    }

    return 0;

}