#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 ) {
				for( int k = i + 1; k < n; k++ ) {
					tie( x2, y2, r2, j2 ) = a[k];
					if( x2 > x ) break;
				}
				int mi = INT32_MAX;
				int x0 = -1;
				int y0 = -1;
				for( int l = y + 1; l <= y1; l++ ) {
					for( int k = x + 1; k <= x2; k++ ) {
						int d = abs((k - x) * (l - y) - r);
						if( d < mi ) {
							mi = d;
							x0 = k;
							y0 = l;
						}
					}
				}
				if( y0 < 0 ) {
					x0 = x + 1;
					y0 = y + 1;
				}
				ans[j] = T( x, y, x0, y0 );
			}
			else {
				int mi = INT32_MAX;
				int x0 = -1;
				int ll = 0;
				for( int l = 1; l <= 10000; l++ ) {
					for( int k = x + 1; k <= x1; k++ ) {
						int d = abs((k - x) * l - r);
						if( d < mi ) {
							mi = d;
							ll = l;
							x0 = k;
						}
					}
				}
				if( x0 < 0 ) {
					x0 = x + 1;
					ll = 1;
				}
				int y0 = y;
				int y2 = y + ll;
				if( y2 > 10000 ) {
					y0 = y - (y2 - 10000);
					y2 = 10000;
				}
				ans[j] = T( x, y0, x0, 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>
#define rep(i,N) for(int i=0;i<(N);i++)
#define rrep(i, n) for (int i = (int)n-1; i >= 0; --i)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;

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; }

__attribute__ ((constructor))
void fastio() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
}

int main(){
    int n;
    cin >> n;

    vector<int> a(n), b(n), r(n);
    rep(i, n) cin >> a[i] >> b[i] >> r[i];

    vector<int> a_, b_, c_, d_;
    rep(i,n) {
        a_.push_back(a[i]);
        b_.push_back(b[i]);
        c_.push_back(a[i] + 1);
        d_.push_back(b[i] + 1);
    }
    rep(i, n){
        cout << a_[i] << " " << b_[i] << " " << c_[i] << " " << d_[i] << endl;
    }
    return 0;
}