#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <random>
#include <fstream>

using ll = long long int;
using P = std::pair<ll, ll>;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);
const int TT = 157;
const int SS = 5;

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int x[222],y[222],r[222],a[222],b[222],c[222],d[222];
bool mp[10000][10000];

bool fil_row(int p, int l, int r){
	int i;
	bool flag = false;
	if(!(0 <= p && p < 10000)){
		return false;
	}
	for(i=l; i<r; ++i){
		flag |= mp[p][i];
	}
	if(flag){
		return false;
	}
	for(i=l; i<r; ++i){
		mp[p][i] = true;
	}
	return true;
}

bool fil_col(int p, int l, int r){
	int i;
	bool flag = false;
	if(!(0 <= p && p < 10000)){
		return false;
	}
	for(i=l; i<r; ++i){
		flag |= mp[i][p];
	}
	if(flag){
		return false;
	}
	for(i=l; i<r; ++i){
		mp[i][p] = true;
	}
	return true;
}

bool del_row(int p, int l, int r, int s){
	int i;
	if(a[s] >= c[s]){
		return true;
	}
	if(b[s] >= d[s]){
		return true;
	}
	if(!(a[s] <= x[s] && x[s] < c[s])){
		return true;
	}
	if(!(b[s] <= y[s] && y[s] < d[s])){
		return true;
	}
	for(i=l; i<r; ++i){
		mp[p][i] = false;
	}
	return false;
}

bool del_col(int p, int l, int r, int s){
	int i;
	if(a[s] >= c[s]){
		return true;
	}
	if(b[s] >= d[s]){
		return true;
	}
	if(!(a[s] <= x[s] && x[s] < c[s])){
		return true;
	}
	if(!(b[s] <= y[s] && y[s] < d[s])){
		return true;
	}
	for(i=l; i<r; ++i){
		mp[i][p] = false;
	}
	return false;
}

bool score(int i, int j){
	int before,after;
	before = (c[i]-a[i])*(d[i]-b[i]);
	if(j<2){
		after = before + (d[i]-b[i]);
	}else if(j<4){
		after = before + (c[i]-a[i]);
	}else if(j<6){
		after = before - (d[i]-b[i]);
	}else{
		after = before - (c[i]-a[i]);
	}
	return 1ll*std::min(after,r[i])*std::max(before,r[i]) > 1ll*std::min(before,r[i])*std::max(after,r[i]);
}

int main(void){
	int n,i,tm,j,k,calc=33*32;
	tm = clock();
	std::random_device seed_gen;
	std::default_random_engine engine(seed_gen());
	scanf("%d",&n);
	std::uniform_int_distribution<> rnd1(0,n-1);
	std::uniform_int_distribution<> rnd2(0,8);
	for(i=0; i<n; ++i){
		scanf("%d%d%d",&x[i],&y[i],&r[i]);
		mp[x[i]][y[i]] = true;
		a[i] = x[i]; b[i] = y[i]; c[i] = x[i]+1; d[i] = y[i]+1;
	}
	while(clock() - tm < ((TT * CLOCKS_PER_SEC) >> SS)){
		i = rnd1(engine);
		j = rnd2(engine);

		if(!score(i,j) && ((seed_gen())%(calc>>4))){
			continue;
		}
		switch(j){
			case 0:
			if(fil_row(a[i]-1,b[i],d[i])){
				--a[i];
			}
			break;
			case 1:
			if(fil_row(c[i],b[i],d[i])){
				++c[i];
			}
			break;
			case 2:
			if(fil_col(b[i]-1,a[i],c[i])){
				--b[i];
			}
			break;
			case 3:
			if(fil_col(d[i],a[i],c[i])){
				++d[i];
			}
			break;
			case 4:
			++a[i];
			if(del_row(a[i]-1,b[i],d[i],i)){
				--a[i];
			}
			break;
			case 5:
			--c[i];
			if(del_row(c[i],b[i],d[i],i)){
				++c[i];
			}
			break;
			case 6:
			++b[i];
			if(del_col(b[i]-1,a[i],c[i],i)){
				--b[i];
			}
			break;
			default:
			--d[i];
			if(del_col(d[i],a[i],c[i],i)){
				++d[i];
			}
			break;
		}
		++calc;
    }
    for(i=0; i<n; ++i){
    	printf("%d %d %d %d\n",a[i],b[i],c[i],d[i]);
    }
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define P pair<ll,ll>
using Graph = vector<vector<int>>;

int main(){
    int N; cin >> N;
    int x[N],y[N],r[N],a[N],b[N],c[N],d[N];
    vector<tuple<int,int,int,int>> order;
    //set<P> used;
    //vector<vector<P>> rowfront; vector<vector<P>> rowback;
    //vector<vector<P>> columnfront; vector<vector<P>> columnback;
    vector<vector<P>> column(10000); vector<vector<P>> row(10000);
    rep(i,N){
        cin >> x[i] >> y[i] >> r[i];
        order.push_back(make_tuple(r[i],x[i],y[i],i));
        //rowfront[x[i]].push_back(make_pair(y[i],y[i])); rowback[x[i]].push_back(make_pair(y[i],y[i]));
        //coulmnfront[y[i]].push_back(make_pair(x[i],x[i])); columnback[y[i]].push_back(make_pair(x[i],x[i]));
        column[y[i]].push_back(make_pair(x[i],x[i])); row[x[i]].push_back(make_pair(y[i],y[i]));
    }
    sort(order.begin(),order.end());
    rep(i,N){
        //s:r p:x q:y k:i
        int s = get<0>(order[i]); int p = get<1>(order[i]);
        int q = get<2>(order[i]); int k = get<3>(order[i]);
        int fx = 0; int bx = 0; int fy = 0; int by = 0;
        bool fxok = true; bool bxok = true; bool fyok = true; bool byok = true;
        rep(j,10000){
            if((fx+bx+3)*(fy+by+3)>s) break;
            if(p-bx-1<0) bxok = false;
            if(p+fx+1>9999) fxok = false;
            if(q-by-1<0) byok = false;
            if(q+fy+1>9999) fyok = false;
            if(byok){
                for(auto range:column[q-j-1]){
                    int ini = range.first; int fin = range.second;
                    if(ini>p+fx||fin<p-bx) continue;
                    byok = false; break;
                }
                if(byok) by = j+1;
            }
            if(fyok){
                for(auto range:column[q+j+1]){
                    int ini = range.first; int fin = range.second;
                    if(ini>p+fx||fin<p-bx) continue;
                    fyok = false; break;
                }
                if(fyok) fy = j+1;
            }
            if(bxok){
                for(auto range:row[p-j-1]){
                    int ini = range.first; int fin = range.second;
                    if(ini>q+fy||fin<q-by) continue;
                    bxok = false; break;
                }
                if(bxok) bx = j+1;
            }
            if(fxok){
                for(auto range:row[p+j+1]){
                    int ini = range.first; int fin = range.second;
                    if(ini>q+fy||fin<q-by) continue;
                    fxok = false; break;
                }
                if(fxok) fx = j+1;
            }
            if(!fxok&&!bxok&&!fyok&&!byok) break;
        }
        column[q+fy].push_back(make_pair(p-bx,p+fx));
        column[q-by].push_back(make_pair(p-bx,p+fx));
        row[p+fx].push_back(make_pair(q-by,q+fy));
        row[p-bx].push_back(make_pair(q-by,q+fy));
        //------------------------
        a[k] = p-bx; c[k] = p+fx+1;
        b[k] = q-by; d[k] = q+fy+1;
    }
    cout << endl << endl << endl;
    rep(i,N){
        cout << a[i] << " " << b[i] << " "
        <<  c[i] << " " << d[i] << endl;
    }
}