#include<bits/stdc++.h>
#include<fstream>

//#define DEBUG
#define rng(a) a.begin(),a.end()

using namespace std;

/* s_i(広告の面積) が r_i(与えられる値) に近ければ近いほどいい */

//50<=N<=200
int N;

//0<=x<=9999,0<=y<=9999,1<=r,rは整数,sum(r)=10000*10000
vector<int>x,y,r;

//space
int H,W;
vector<vector<bool>>space;

vector<vector<int>>ans;

#ifdef DEBUG
ifstream ifs;
ofstream ofs_input;
ofstream ofs_output;
#endif

void input(){

#ifdef DEBUG
  ifs>>N;
  x.resize(N);
  y.resize(N);
  r.resize(N);
  for(int i=0;i<N;i++)ifs>>x[i]>>y[i]>>r[i];
  ofs_input<<N<<endl;
  for(int i=0;i<N;i++)ofs_input<<x[i]<<" "<<y[i]<<" "<<r[i]<<endl;

#else
  cin>>N;
  x.resize(N);
  y.resize(N);
  r.resize(N);
  for(int i=0;i<N;i++)cin>>x[i]>>y[i]>>r[i];

#endif

}

void setup(){
  H=10001;
  W=10001;

  ans.resize(N);
  space.resize(H,vector<bool>(W,false));

#ifdef DEBUG
  fill(rng(ans),vector<int>(4,0));
  fill(rng(space),vector<bool>(W,false));
#endif

}

double double_score(){
  double score=0;
  for(int i=0;i<N;i++){
    int a=ans[i][0];
    int b=ans[i][1];
    int c=ans[i][2];
    int d=ans[i][3];
    if(a<=x[i]&&x[i]<b&&c<=y[i]&&y[i]<d){
      int s=abs(a-b)*abs(c-d);
      int MIN=min(s,r[i]);
      int MAX=max(s,r[i]);
      double p=1-(1-1.*MIN/MAX)*(1-1.*MIN/MAX);
      score+=p;
    }
  }
  return score;
}

int main(){

#ifdef DEBUG
  for(int debug=0;debug<1;debug++){
    stringstream filename;
    filename<<setw(4)<<setfill('0')<<debug;
    ifs.open("../tools/in/"+filename.str()+".txt");
    ofs_input.open(filename.str()+"_input"+".txt");
    ofs_output.open(filename.str()+"_output"+".txt");
    cout<<"-------------------------------"<<endl;
    cout<<filename.str()+".txt"<<endl;
    cout<<"-------------------------------"<<endl;
#endif

  input();
  setup();

  for(int i=0;i<N;i++){
    ans[i]={x[i],y[i],x[i]+1,y[i]+1};
  }
  //cout<<"double_score:"<<double_score()<<endl;
  for(auto it:ans){
    for(auto it:it)cout<<it<<" ";
    cout<<endl;
  }
#ifdef DEBUG
  for(auto it:ans){
    for(auto it:it)ofs_output<<it<<" ";
    ofs_output<<endl;
  }
  ifs.close();
  ofs_input.close();
  ofs_output.close();
  }
#endif

}

#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

ll n;
vector<ll> x, y, r;

const ll LIM = 10000;

struct STATE {
	vector<P> loc;
	vector<P> area;
};

void init(STATE &state){
	state.loc.resize(n);
	state.area.resize(n);
	rep(i,n){
		state.loc[i] = P(0, i);
		state.area[i] = P(1, 1);
	}
}

bool isOverlapped(STATE &state, ll j, ll X, ll Y){
	vector<P> now(4);
	now[0] = P(y[j], x[j]);
	now[1] = P(y[j], x[j] + X);
	now[2] = P(y[j] + Y, x[j] + X);
	now[3] = P(y[j] + Y, x[j]);
	rep(i,n){
		if(i == j) continue;
		ll L = x[i];
		ll R = x[i] + state.area[i].second;
		ll U = y[i];
		ll D = y[i] + state.area[i].first;
		rep(k,4){
			if(now[k].first < U) continue;
			if(D < now[k].first) continue;
			if(now[k].second < L) continue;
			if(R < now[k].second) continue;
			return true;
		}
		if(x[j] <= L && R <= x[j] + X && !(D <= y[j]) && !(y[j] + Y <= U)) return true;
		if(y[j] <= U && D <= y[j] + Y && !(R <= x[j]) && !(x[j] + X <= L)) return true;
	}
	return false;
}

#include <random>

void modify(STATE &state){
	std::random_device rnd;
	std:: mt19937 mt(rnd());
	std::uniform_int_distribution<> randN(0,n-1);
	int j = randN(mt);
	std::uniform_int_distribution<> randH(1,r[j]);
	ll h = randH(mt);
	if(y[j] + h > LIM) return;
	ll w = r[j] / h;
	if(x[j] + w > LIM) return;
	if(isOverlapped(state, j, w, h)) return;
	state.loc[j] = P(y[j], x[j]);
	state.area[j] = P(h, w);
}

ll calc_score(STATE &state){
	ll score = 0;
	rep(i,n){
		ll R = state.area[i].first * state.area[i].second;
		ll tmp = (min(r[i], R) * 100) / (max(r[i], R) * 100);
		score += 10000 - (100 - tmp) * (100 - tmp);
	}
	score /= n;
	return score;
}

void solve(){
	STATE state;
	init(state);
	const long double TL = 4.8;
	while(true){
		long double terminal = (long double)clock() / (long double)CLOCKS_PER_SEC;
		if(terminal >= TL) break;
		modify(state);
	}
	rep(i,n){
		ll y = state.loc[i].first;
		ll x = state.loc[i].second;
		ll dy = state.area[i].first;
		ll dx = state.area[i].second;
		cout << x << " " << y << " " << x+dx << " " << y+dy << endl;
	}
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> n;
	rep(i,n){
		ll X, Y, R;
		cin >> X >> Y >> R;
		x.push_back(X);
		y.push_back(Y);
		r.push_back(R);
	}
	solve();
	return 0;
}