#include<bits/stdc++.h>
#define int long long
#define for0(i, n) for(int i = 0; i < (n); i++)
#define for1(i, n) for(int i = 1; i <= (n);i++)
#define puts(x) cout << (x) << "\n"
using namespace std;
int n, x[300], y[300], R[300], xe[300], ye[300];
bool fb(int i, int j) {
	if (x[i] + xe[i] <= x[j])return 1;
	if (x[j] + xe[j] <= x[i])return 1;
	if (y[i] + ye[i] <= y[j])return 1;
	if (y[j] + ye[j] <= y[i])return 1;
	return 0;
}
bool fball(int i) {
	if (x[i] + xe[i] > 10000 || y[i] + ye[i] > 10000 || x[i] < 0 || y[i] < 0)return 0;
	for0(j, n) if (i != j && !fb(i, j))return 0;
	return 1;
}
signed main() {
	cin >> n;
	for0(i, n) {
		cin >> x[i] >> y[i] >> R[i]; xe[i] = 1; ye[i] = 1;
	}
	for0(i, n) {
		int l = 1, r = (int)sqrt(R[i]) + 1;
		while (r - l > 1) {
			int mid = (l + r) / 2;
			xe[i] = mid; ye[i] = mid;
			if (fball(i))l = mid; else r = mid;
		}
		xe[i] = l; ye[i] = l;
	}
	for0(valsq, 1000)for0(i, n) if (xe[i] * ye[i] < R[i]) {
		if (x[i] + xe[i] < 10000 - 9) { xe[i] += 10; if (fball(i))continue; xe[i] -= 10; }
		if (y[i] + ye[i] < 10000 - 9) { ye[i] += 10; if (fball(i))continue; ye[i] -= 10; }
		if (x[i] + xe[i] < 10000) { xe[i]++; if (fball(i))continue; xe[i]--; }
		if (y[i] + ye[i] < 10000) { ye[i]++; if (fball(i))continue; ye[i]--; }
	}
	for0(valsq, 1000)for0(i, n) if (xe[i] * ye[i] < R[i]) {
		if (x[i] >= 10) { x[i] -= 10; xe[i] += 10; if (fball(i))continue; x[i] += 10; xe[i] -= 10; }
		if (y[i] >= 10) { y[i] -= 10; ye[i] += 10; if (fball(i))continue; y[i] += 10; ye[i] -= 10; }
		if (x[i] > 0) { x[i]--; xe[i]++; if (fball(i))continue; x[i]++; xe[i]--; }
		if (y[i] > 0) { y[i]--; ye[i]++; if (fball(i))continue; y[i]++; ye[i]--; }
	}
	for0(i, n)cout << x[i] << ' ' << y[i] << ' ' << x[i] + xe[i] << ' ' << y[i] + ye[i] << endl;
}
#include <iostream>
#include <queue>
using namespace std;

const int da[4] = {-1, 0, 0, 0};
const int db[4] = {0, -1, 0, 0};
const int dc[4] = {0, 0, 1, 0};
const int dd[4] = {0, 0, 0, 1};

const int D = 10000;

struct Str
{
    int s, r;
    int id;
    int dir;
    
    bool operator<(const Str &right)const{
        if(s * right.r != r * right.s) return s * right.r > r * right.s;
        if(s != right.s) return s < right.s;
        return id < right.id;
    }
};

bool safe(int x1, int y1, int x2, int y2, int i, int n, int *a, int *b, int *c, int *d){
    if(x1 < 0 || y1 < 0 || x2 > D || y2 > D) return false;
    for(int j = 0; j < n; j++){
        if(j == i) continue;
        bool f = (x1 <= a[j] && a[j] < x2) || (a[j] <= x1 && x1 < c[j]);
        bool g = (y1 <= b[j] && b[j] < y2) || (b[j] <= y1 && y1 < d[j]);
        if(f && g) return false;
    }
    return true;
}

int main()
{
    int n;
    cin >> n;
    int x[202], y[202], r[202];
    int a[202], b[202], c[202], d[202];
    Str str[202];
    priority_queue<Str> que;
    for(int i = 0; i < n; i++){
        cin >> x[i] >> y[i] >> r[i];
        a[i] = x[i], b[i] = y[i], c[i] = x[i] + 1, d[i] = y[i] + 1;
        str[i].s = 1, str[i].r = r[i], str[i].id = i, str[i].dir = 0;
        que.push(str[i]);
    }
    while(que.size()){
        int i = que.top().id;
        que.pop();
        for(int k = 0; k < 4; k++){
            int dir = (str[i].dir + k) % 4;
            int s = ((c[i] + dc[dir]) - (a[i] + da[dir])) * ((d[i] + dd[dir]) - (b[i] + db[dir]));
            if(s <= str[i].r &&
               safe(a[i] + da[dir], b[i] + db[dir], c[i] + dc[dir], d[i] + dd[dir], i, n, a, b, c, d)){
                str[i].s = s;
                str[i].dir = (dir + 1) % 4;
                a[i] += da[dir]; b[i] += db[dir]; c[i] += dc[dir]; d[i] += dd[dir];
                que.push(str[i]);
                break;
            }
        }
    }
    for(int i = 0; i < n; i++) cout << a[i] << " " << b[i] << " " << c[i] << " " << d[i] << endl;
}
