#include <bits/stdc++.h>
using namespace std;
mt19937 rng(58);
typedef double db;
const int N = 10000;
bool sold[N][N];

struct rect{
	int lx, ly, rx, ry;
	rect(){}
	rect(int x, int y){
		lx = x; rx = x + 1;
		ly = y; ry = y + 1;
	}
	
	rect(int _lx, int _ly, int _rx, int _ry){
		lx = _lx; ly = _ly;
		rx = _rx; ry = _ry;
	}
	
	bool contains(int x, int y) const{
		return lx <= x && x < rx && ly <= y && y < ry;
	}
	
	int area() const{
		return (rx - lx) * (ry - ly);
	}
	
	bool intersects(const rect& other) const{
		return max(lx, other.lx) < min(rx, other.rx) && max(ly, other.ly) < min(ry, other.ry);
	}
	
	void write() const{
		cout << lx << ' ' << ly << ' ' << rx << ' ' << ry << endl;
	}
};

inline bool can_extend(rect& r, int dir){
	if (dir == 0){
		if (r.rx < N){
			for(int i = r.ly; i < r.ry; ++i){
				if (sold[r.rx][i]){
					return false;
				}
			}
			
			for(int i = r.ly; i < r.ry; ++i){
				sold[r.rx][i] = 1;
			}
			
			r.rx++;
			return true;
		}
	}else if (dir == 1){
		if (r.lx > 0){
			for(int i = r.ly; i < r.ry; ++i){
				if (sold[r.lx - 1][i]){
					return false;
				}
			}
			
			r.lx--;
			for(int i = r.ly; i < r.ry; ++i){
				sold[r.lx][i] = 1;
			}
			return true;
		}
	}else if (dir == 2){
		
		if (r.ry < N){
			for(int i = r.lx; i < r.rx; ++i){
				if (sold[i][r.ry]){
					return false;
				}
			}
			
			for(int i = r.lx; i < r.rx; ++i){
				sold[i][r.ry] = 1;
			}
			
			r.ry++;
			return true;
		}
	}else{
		if (r.ly > 0){
			for(int i = r.lx; i < r.rx; ++i){
				if (sold[i][r.ly - 1]){
					return false;
				}
			}
		
			r.ly--;
			for(int i = r.lx; i < r.rx; ++i){
				sold[i][r.ly] = 1;
			}
			
			return true;
		}
	}
	
	return false;
}

struct query{
	int x, y, r, id;	
	void read(int _id){
		cin >> x >> y >> r;
		id = _id;
	}
	
	db score(rect R){
		if (!R.contains(x, y)) return 0;
		db val = min(r, R.area()) / (db) max(r, R.area());
		cerr << val << endl;
		return 1 - (1 - val) * (1 - val);
	}
};

int main(){
	int n; cin >> n;
	vector<query> queries(n);
	for(int i = 0; i < n; ++i){
		queries[i].read(i);
	}
	
	vector<rect> answer(n);
	for(int i = 0; i < n; ++i){
		answer[i] = rect(queries[i].x, queries[i].y);
		sold[queries[i].x][queries[i].y] = true;
	}
	
	vector<int> order(n);
	iota(order.begin(), order.end(), 0);
	sort(order.begin(), order.end(), [&](int u, int v) {return queries[u].r > queries[v].r;});
	
	for(int i: order){
		query q = queries[i];
		rect& answer_now = answer[i];
		vector<int> order_dir = {0, 1, 2, 3};
		while(answer_now.area() < q.r){
			shuffle(order_dir.begin(), order_dir.end(), rng);
			bool extended = false;
			for(int dir: order_dir){
				if (can_extend(answer_now, dir)){
					extended = true;
					break;
				}
			}
			
			if (!extended){
				break;
			}
		}
	}
	
	db score = 0;
	for(int i = 0; i < n; ++i){
		score += queries[i].score(answer[i]);
	}
	
	score /= n;
	score *= 1000000000;
	
	cerr << (int)score << endl;
	for(int i = 0; i < n; ++i){
		for(int j = 0; j < i; ++j){
			if (answer[i].intersects(answer[j])){
				assert(false);
			}
		}
	}
	
	for(int i = 0; i < n; ++i){
		answer[i].write();
	}
			
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

typedef unsigned uint;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ldbl;
typedef pair<int, int> pii;
typedef pair<uint, uint> puu;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pull;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<uint> vu;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pii> vpii;
typedef vector<puu> vpuu;
typedef vector<pll> vpll;
typedef vector<pull> vpull;
typedef vector<string> vstr;
typedef vector<double> vdbl;
typedef vector<ldbl> vldbl;
#define pb push_back
#define ppb pop_back
#define pfr push_front
#define ppfr pop_front
#define emp emplace
#define empb emplace_back
#define be begin
#define rbe rbegin
#define all(x) (x).be(), (x).end()
#define rall(x) (x).rbe(), (x).rend()
#define fir first
#define sec second
#define mkp make_pair
#define brif(cond) if (cond) break
#define ctif(cond) if (cond) continue
#define retif(cond) if (cond) return
void canhazfast() {ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);}
template<typename T> T gcd(T a, T b) {return b ? gcd(b, a%b) : a;}
template<typename T> T extgcd(T a, T b, T &x, T &y)
{
    T x0 = 1, y0 = 0, x1 = 0, y1 = 1;
    while (b) {
        T q = a/b; a %= b; swap(a, b);
        x0 -= q*x1; swap(x0, x1);
        y0 -= q*y1; swap(y0, y1);
    }
    x = x0; y = y0; return a;
}
int ctz(uint x) {return __builtin_ctz(x);}
int ctzll(ull x) {return __builtin_ctzll(x);}
int clz(uint x) {return __builtin_clz(x);}
int clzll(ull x) {return __builtin_clzll(x);}
int popcnt(uint x) {return __builtin_popcount(x);}
int popcntll(ull x) {return __builtin_popcountll(x);}
int bsr(uint x) {return 31^clz(x);}
int bsrll(ull x) {return 63^clzll(x);}

#define N 200
#define W 10000
#define MULT 1e9

struct C {
    int x, y, r;
};

struct R {
    int a, b, c, d;
};

int per[N];
C c[N];
R ans[N];

bool cmp_xy(int l, int r)
{
    return c[l].x != c[r].x ? c[l].x < c[r].x : c[l].y < c[r].y;
}

bool cmp_yx(int l, int r)
{
    return c[l].y != c[r].y ? c[l].y < c[r].y : c[l].x < c[r].x;
}

bool cmp_r(int l, int r)
{
    return c[l].r < c[r].r;
}

bool inside(const C &com, const R &rec)
{
    return com.x >= rec.a && com.x < rec.c && com.y >= rec.b && com.y < rec.d;
}

double calc(const C &com, const R &rec)
{
    retif(!inside(com, rec)) 0.0;
    int s = (rec.c-rec.a)*(rec.d-rec.b);
    double t = 1.0-(double)min(com.r, s)/max(com.r, s);
    return 1.0-t*t;
}

double eval(int n)
{
    double res = 0.0;
    for (int i = 0; i < n; ++i) res += calc(c[i], ans[i]);
    return res*MULT/n;
}

void dumb_split(int b, int e, int xl = 0, int xh = W, int yl = 0, int yh = W)
{
    int m = -1, pos = -1;

    if (b+1 == e) {
        int u = per[b];
        ans[u] = {xl, yl, xh, yh};
        return;
    }

    sort(per+b, per+e, cmp_xy);
    for (int i = b+1; i < e; ++i) {
        int u = per[i-1], v = per[i];
        if (c[u].x != c[v].x) {
            pos = (c[u].x+c[v].x+1)/2;
            m = i;
            break;
        }
    }
    if (m >= 0) {
        dumb_split(b, m, xl, pos, yl, yh);
        dumb_split(m, e, pos, xh, yl, yh);
        return;
    }

    sort(per+b, per+e, cmp_yx);
    for (int i = b+1; i < e; ++i) {
        int u = per[i-1], v = per[i];
        if (c[u].y != c[v].y) {
            pos = (c[u].y+c[v].y+1)/2;
            m = i;
            break;
        }
    }
    assert(m >= 0);
    dumb_split(b, m, xl, xh, yl, pos);
    dumb_split(m, e, xl, xh, pos, yh);
}

int main()
{
    canhazfast();

    int n;

    /// in
    cin >> n;
    for (int i = 0; i < n; ++i) cin >> c[i].x >> c[i].y >> c[i].r;
    iota(per, per+n, 0);

    /// 0
    /*for (int i = 0; i < n; ++i) {
        ans[i] = {c[i].x, c[i].y, c[i].x+1, c[i].y+1};
    }*/

    /// 1
    dumb_split(0, n);

    /// out
    for (int i = 0; i < n; ++i) cout << ans[i].a << ' ' << ans[i].b << ' ' << ans[i].c << ' ' << ans[i].d << '\n';
    cerr << eval(n) << '\n';

    return 0;
}
