#include <bits/stdc++.h>
using namespace std;

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

	sort( a.begin(), a.end() );
	vector<T> ans( n );
	for( int i = 0; i < n; i++ ) {
		int x, y, r, j;
		tie( x, y, r, j ) = a[i];
		if( i == 0 ) {
			int mi = INT32_MAX;
			int x0 = 0;
			int y0 = 0;
			for( int k = 0; k <= x; k++ ) {
				for( int l = 0; l <= y; l++ ) {
					int d = abs((x + 1 - k) * (y + 1 - l) - r);
					if( d < mi ) {
						mi = d;
						x0 = k;
						y0 = l;
					}
				}
			}
			ans[j] = T( x0, y0, x + 1, y + 1 );
		}
		else if( i == n - 1 ) {
			int mi = INT32_MAX;
			int x0 = 0;
			int y0 = 0;
			for( int k = 10000; k >= x; k-- ) {
				for( int l = 10000; l >= y; l-- ) {
					int d = abs((k - x) * (l - y) - r);
					if( d < mi ) {
						mi = d;
						x0 = k;
						y0 = l;
					}
				}
			}
			ans[j] = T( x, y, x0, y0 );
		}
		else {
			int x1, y1, r1, j1;
			tie( x1, y1, r1, j1 ) = a[i + 1];
			int x2, y2, r2, j2;
			tie( x2, y2, r2, j2 ) = a[i - 1];
			if( x == x1 || x == x2 ) {
				int mi = INT32_MAX;
				int y0 = -1;
				for( int l = y + 1; l <= y1; l++ ) {
					int d = abs((l - y) - r);
					if( d < mi ) {
						mi = d;
						y0 = l;
					}
				}
				if( y0 < 0 ) y0 = y + 1;
				ans[j] = T( x, y, x + 1, y0 );
			}
			else {
				int mi = INT32_MAX;
				int y0 = 0;
				int y2 = 10000;
				for( int l = 0; l <= y; l++ ) {
					for( int k = y + 1; k <= 10000; k++ ) {
						int d = abs((x1 - x) * (k - l) - r);
						if( d < mi ) {
							mi = d;
							y0 = l;
							y2 = k;
						}
					}
				}
				ans[j] = T( x, y0, x1, y2 );
			}
		}
	}
	for( int i = 0; i < n; i++ ) {
		int x, y, x1, y1;
		tie( x, y, x1, y1 ) = ans[i];
		cout << x << " " << y << " " << x1 << " " << y1 << endl;
	}
}

#include <bits/stdc++.h>

using namespace std;

int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        int x, y, r;
        cin >> x >> y >> r;
        cout << x << " " << y << " " << x + 1 << " " << y + 1 << endl;
    }
    return 0;
}
