#include<iostream>

#include<cstdio>

#include<vector>

#include<algorithm>

#include<cmath>

#include<chrono>

using namespace std;

/*unsigned int rnd()

{

	static unsigned int y=2463534242;	y^=y<<13;

	y^=y>>17;

	return y^=y<<5;

}*/

/*

unsigned int rnd()

{

    static unsigned int x=123456789,y=362436069,z=521288629,w=88675123;

    unsigned int t;

    t=x^(x<<11);

	x=y;

	y=z;

	z=w;

	return w^=(w>>19)^t^(t>>8);

}*/

unsigned long rnd(){

	static unsigned long x=88172645463325252UL;

	x^=x<<7;

	x^=x>>9;

	return x;

}

int N;

int X[200],Y[200],R[200];

int A[200][4];

int ch_mem[200];

int area(int id){return (A[id][2]-A[id][0])*(A[id][3]-A[id][1]);}

bool intersect(int i,int j)

{

	return !(A[i][2]<=A[j][0]

	||A[j][2]<=A[i][0]

	||A[i][3]<=A[j][1]

	||A[j][3]<=A[i][1]);

}

bool contain(int x,int y,int id)

{

	return A[id][0]<=x&&x<A[id][2]&&A[id][1]<=y&&y<A[id][3];

}

double point(int id)

{

	if(A[id][0]<=X[id]&&X[id]<A[id][2]

		&&A[id][1]<=Y[id]&&Y[id]<A[id][3])

	{

		int S=area(id);

		return 1-pow(1-(double)min(R[id],S)/max(R[id],S),2);

	}

	else return 0;

}

using score=double;

score contain_point(int id)

{

	long S=area(id),T=R[id];

	if(S>T)swap(S,T);

	return 1-(T-S)*(T-S)/(double)(T*T);

}

bool prob(score nxt,score prv,double temp)

{

	score x=(nxt-prv)/temp;

	return (1+x

		+x*x*.5

		+x*x*x*.166666666666

		//+x*x*x*x*.041666666666666

		//+x*x*x*x*x*.008333333333333

		)*(1<<30)>(rnd()&(1<<30)-1);

	//return exp(x)*(1<<30)>(rnd()&(1<<30)-1);

}

int main()

{

	scanf("%d",&N);

	for(int i=0;i<N;i++)scanf("%d%d%d",&X[i],&Y[i],&R[i]);

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

	{

		A[i][0]=X[i];

		A[i][1]=Y[i];

		A[i][2]=X[i]+1;

		A[i][3]=Y[i]+1;

	}

	chrono::system_clock::time_point start=chrono::system_clock::now();

	const long long TL=4.95*1e9;

	const double start_temp=0.025;

	const double end_temp=0.0000005;

	int iteration=0;

	while(true)

	{

		long long nowTime=chrono::duration_cast<chrono::nanoseconds>(chrono::system_clock::now()-start).count();

		if(nowTime>TL)break;

		double temp=start_temp+(end_temp-start_temp)*nowTime/TL;

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

		{

			iteration++;

			int id=rnd()%N;

			int r=rnd()%4;

			int add=r<2?-1:1;

			score prv=contain_point(id);

			int prvA=A[id][r];

			A[id][r]+=add;

			if(A[id][r]<0||A[id][r]>10000)

			{

				A[id][r]-=add;

				continue;

			}

			score nxt=contain_point(id);

			if(prv>nxt)

			{

				A[id][r]-=add;

				continue;

			}

			int chr=0;

			bool ok=true;

			int vr=r^1;

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

			{

				if(i!=id&&A[i][r^2]==prvA&&!(A[i][vr|2]<=A[id][vr&1]||A[id][vr|2]<=A[i][vr&1]))

				{

					if((r<2?A[i][r^2]+add:A[i][r^2])==(r&1?Y:X)[i])

					{

						ok=false;

						break;

					}

					prv+=contain_point(i);

					A[i][r^2]+=add;

					nxt+=contain_point(i);

					ch_mem[chr++]=i;

				}

			}

			if(ok&&(nxt>prv||prob(nxt,prv,temp)))

			{

			}

			else

			{

				A[id][r]-=add;

				for(int j=0;j<chr;j++)A[ch_mem[j]][r^2]-=add;

			}

		}

	}

	cerr<<iteration<<endl;

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

	{

		for(int r=0;r<4;r++)

		{

			int X=area(id);

			int add=r<2?-1:1;

			A[id][r]+=add;

			if(A[id][r]<0||A[id][r]>10000)

			{

				A[id][r]-=add;

				continue;

			}

			int Y=area(id);

			if(R[id]<=X||R[id]<Y&&(long)X*Y>(long)R[id]*R[id])

			{

				A[id][r]-=add;

				continue;

			}

			bool ok=true;

			for(int i=0;i<N;i++)if(i!=id)

			{

				if(intersect(i,id))

				{

					ok=false;

					break;

				}

			}

			if(!ok)A[id][r]-=add;

		}

	}

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

	{

		//cerr<<i<<" : "<<point(i)<<endl;

		printf("%d %d %d %d\n",A[i][0],A[i][1],A[i][2],A[i][3]);

	}

}
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
typedef long long ll;

int main() {
    int n; cin >> n;
    vector<int> x(n), y(n), r(n);
    for (int i = 0; i < n; i++) cin >> x[i] >> y[i] >> r[i];

    vector<vector<bool>> field(10000, vector<bool>(10000));
    vector<int> a(n), b(n), c(n), d(n);
    for (int i = 0; i < n; i++) { a[i] = x[i]; b[i] = y[i]; c[i] = x[i] + 1; d[i] = y[i] + 1; }
    for (int i = 0; i < n; i++) field[a[i]][b[i]] = true;

    for (int i = 0; i < n; i++) {
        
        for (int j = a[i] - 1; j >= 0; j--) {
            if (field[j][b[i]]) { a[i] = j + 1; break; }
            //else if (j == 0) { field[0][b[i]] = true; a[i] = 0; } 
            else field[j][b[i]] = true; a[i] = j;
        }

        for (int j = c[i]; j < 10000; j++) {
            if (field[j][b[i]]) { c[i] = j; break; }
            //else if (j == 9999) { field[9999][b[i]] = true; c[i] = 10000; }
            else field[j][b[i]] = true; c[i] = j + 1;
        }

    }

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

        for (int j = b[i] - 1; j >= 0; j--) {
            if (field[a[i]][j]) { b[i] = j + 1; break; }
            else for (int k = a[i]; k < c[i]; k++) field[k][j] = true; b[i] = j; 
        }

        /*
        for (int j = d[i]; j < 10000; j++) {
            if (field[a[i]][j]) { d[i] = j; break; }
            else for (int k = a[i]; k < c[i]; k++) field[k][j] = true; d[i] = j + 1; 
        }
        */

    }
    
    for (int i = 0; i < n; i++) {
        printf("%d %d %d %d\n", a[i], b[i], c[i], d[i]);
    }
    //cout << field[2297][9999] << endl;
    return 0;
}