#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define all(v) v.begin(), v.end()

using namespace std;
using ll = long long;

struct Input{
    int n;
    struct Data
    {
        int x, y, r;
    };
    Input(){}

    vector<Data> data;

    void in(){
        cin >> n;
        data.resize(n);
        for (int i = 0; i < n; i++) cin >> data[i].x >> data[i].y >> data[i].r;
    }
};

//ミョ(-ω- ?)
int main() {
    Input input;
    input.in();


    rep(i,input.n){
        cout << input.data[i].x << " " << input.data[i].y << " " << input.data[i].x + 1<< " " 
             << input.data[i].y + 1 << "\n";
    }
    return 0;
}
//雪花飄飄北風嘯嘯
//天地一片蒼茫

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
#define ll long long
#define ii pair<ll,ll>
#define iii pair<ii,ll>
#define fi first
#define se second
#define endl '\n'
#define debug(x) cout << #x << " is " << x << endl

#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define lb lower_bound
#define up upper_bound

#define rep(x,start,end) for(auto x=(start)-((start)>(end));x!=(end)-((start)>(end));((start)<(end)?x++:x--))
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()

#define indexed_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
//change less to less_equal for non distinct pbds, but erase will bug

mt19937 rng(chrono::system_clock::now().time_since_epoch().count());

int n;

struct dim{
	int u,d,l,r;
};

dim rect[205];
ii ori[205];
int r[205];

bool grid[10005][10005];

double sq(double i){return i*i;}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin.exceptions(ios::badbit | ios::failbit);
	
	//freopen("in/0003.txt","r",stdin);
	
	cin>>n;
	
	int a,b,c;
	rep(x,0,n){
		cin>>a>>b>>c;
		
		ori[x]=ii(a,b);
		r[x]=c;
		grid[a][b]=true;
		rect[x]={a,a,b,b};
	}
	
	ll stime=std::chrono::system_clock::now().time_since_epoch().count();
	
	while (std::chrono::system_clock::now().time_since_epoch().count()-stime<4.5e9){
		int idx=rng()%n;
		int dir=rng()%4;
		
		bool can=true;
		if (dir==0){
			if (rect[idx].u==0){can=false;continue;}
			rep(x,rect[idx].l,rect[idx].r+1) if (grid[rect[idx].u-1][x]) can=false;
		}
		if (dir==1){
			if (rect[idx].d==9999){can=false;continue;}
			rep(x,rect[idx].l,rect[idx].r+1) if (grid[rect[idx].d+1][x]) can=false;
		}
		if (dir==2){
			if (rect[idx].l==0){can=false;continue;}
			rep(x,rect[idx].u,rect[idx].d+1) if (grid[x][rect[idx].l-1]) can=false;
		}
		if (dir==3){
			if (rect[idx].r==9999){can=false;continue;}
			rep(x,rect[idx].u,rect[idx].d+1) if (grid[x][rect[idx].r+1]) can=false;
		}
		
		if (!can) continue;
		
		int ai=(rect[idx].d-rect[idx].u+1)*(rect[idx].r-rect[idx].l+1);
		int af=ai+(dir<2?rect[idx].r-rect[idx].l+1:rect[idx].d-rect[idx].u+1);
		
		double ci=1-sq(1-(double)min(ai,r[idx])/max(ai,r[idx]));
		double cf=1-sq(1-(double)min(af,r[idx])/max(af,r[idx]));
		
		//cout<<ci<<" "<<cf<<endl;
		
		if (cf>ci){
			if (dir==0){
				rect[idx].u--;
				rep(x,rect[idx].l,rect[idx].r+1) grid[rect[idx].u][x]=true;
			}
			if (dir==1){
				rect[idx].d++;
				rep(x,rect[idx].l,rect[idx].r+1) grid[rect[idx].d][x]=true;
			}
			if (dir==2){
				rect[idx].l--;
				rep(x,rect[idx].u,rect[idx].d+1) grid[x][rect[idx].l]=true;
			}
			if (dir==3){
				rect[idx].r++;
				rep(x,rect[idx].u,rect[idx].d+1) grid[x][rect[idx].r]=true;
			}
		}
	}
	
	rep(x,0,n){
		cout<<rect[x].u<<" "<<rect[x].l<<" "<<rect[x].d<<" "<<rect[x].r<<endl;
	}
}
