#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) v.begin(),v.end()
constexpr ll MOD=1000000007;
constexpr ll INF=2e18;

struct Ad{ll x, y, r, num;};
struct Recang{
    ll x1, y1, x2, y2;
    ll size(){
        return abs(x2-x1)*abs(y2-y1);
    }
};

mt19937 mt(123);
const int MAX=9999;
int n;

bool overlap(Recang a, Recang b){
    return max(a.x1,b.x1)<min(a.x2,b.x2)&&max(a.y1,b.y1)<min(a.y2,b.y2);
}

bool check(vector<Recang> ans, Recang a, int k){
    REP(i,n){
        if(i==k)
            continue;
        if(overlap(a,ans[i]))
            return 1;
    }
    return 0;
}

bool extension(vector<Recang>& ans, int i, vector<ll> weight){
    Recang& tmpr=ans[i];
    vector<bool> used(4,0);
    vector<int> perm;
    REP(i,4){
        ll sum=0;
        REP(j,4){
            if(!used[j])
                sum+=weight[j];
        }
        ll r;
        if(sum==0)
            r=-1;
        else
            r=mt()%sum;
        REP(j,4){
            if(used[j])
                continue;
            r-=weight[j];
            if(r<0){
                perm.push_back(j);
                used[j]=1;
                break;
            }
        }
    }
    REP(j,4){
        if(perm[j]==0){
            tmpr.x2++;
            if(tmpr.x2>MAX||check(ans,tmpr,i))
                tmpr.x2--;
            else
                return 1;
        }
        else if(perm[j]==1){
            tmpr.y2++;
            if(tmpr.y2>MAX||check(ans,tmpr,i))
                tmpr.y2--;
            else
                return 1;
        }
        else if(perm[j]==2){
            tmpr.x1--;
            if(tmpr.x1<0||check(ans,tmpr,i))
                tmpr.x1++;
            else
                return 1;
        }
        else{
            tmpr.y1--;
            if(tmpr.y1<0||check(ans,tmpr,i))
                tmpr.y1++;
            else
                return 1;
        }
    }
    return 0;
}

void solve(){
    cin >> n;
    vector<Ad> ads(n);
    int x, y, r;
    REP(i,n){
        cin >> x >> y >> r;
        ads[i]=Ad{x,y,r,i};
    }
    vector<vector<ll>> weight(n,vector<ll>(4,0));
    REP(i,n)REP(j,i){
        if(ads[i].x<ads[j].x){
            weight[i][0]+=ads[j].r;
            weight[j][2]+=ads[i].r;
        }
        else{
            weight[i][2]+=ads[j].r;
            weight[j][0]+=ads[i].r;
        }
        if(ads[i].y<ads[j].y){
            weight[i][1]+=ads[j].r;
            weight[j][3]+=ads[i].r;
        }
        else{
            weight[i][3]+=ads[j].r;
            weight[j][1]+=ads[i].r;
        }
    }
    REP(i,n){
        ll sum=0;
        REP(j,4)
            sum+=weight[i][j];
        REP(j,4)
            weight[i][j]=sum-weight[i][j];
    }
    vector<Recang> ans(n);
    REP(i,n){
        Ad ad=ads[i];
        ans[i]={ad.x,ad.y,ad.x+1,ad.y+1};
    }
    priority_queue<pair<double,int>,vector<pair<double,int>>,greater<pair<double,int>>> que;
    REP(i,n) que.push({(double)1/ads[i].r,i});
    while(!que.empty()){
        int i=que.top().second;
        que.pop();
        if(extension(ans,i,weight[i])){
            if(ans[i].size()<ads[i].r)
                que.push({(double)ans[i].size()/ads[i].r,i});
        }
    }
    REP(i,n){
        Recang tmpr=ans[i];
        cout << tmpr.x1 << " ";
        cout << tmpr.y1 << " ";
        cout << tmpr.x2 << " ";
        cout << tmpr.y2 << endl;
    }
}

int main(){
    solve();
    return 0;
}
#pragma region header
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define int ll
#define each(i, a) for (auto &&i : (a))
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using vvs = vector<vs>;
using vd = vector<ld>;
using vvd = vector<vd>;
using vb = vector<bool>;
using vvb = vector<vb>;
using P = pair<int, int>;
using vp = vector<P>;
using int128 = __int128_t;//cin coutはできない
template <class T>
using greater_queue = priority_queue<T, vector<T>, greater<T>>;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a / gcd(a, b) * b;};
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

template <class T>
void CVEC(const T &v) {
	int c = v.size() - 1;
	for (int i = 0; i < c; i++) cout << v[i] << ' ';
	if (c > -1) cout << v[c];
	cout << '\n';
}

#pragma endregion header

int XMAX = 10000;
int YMAX = 10000;


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

struct Point{
	int id, x, y, r;
	bool operator<( const Point& right ) const {
        return x == right.x ? y < right.y : x < right.x;
    }
};

void COUT(Rectangle	x){
	cout << x.a << " " << x.b << " " << x.c << " " << x.d << endl;
}

int n; 
set<P> occupied;
vector<int> area(n, 0);

signed main(){
    cin >> n;
	vector<Point> Ps;
	map<int, Rectangle> ans;
	rep(i,n){
		int x, y, r; cin >> x >> y >> r;
		Ps.push_back({i, x, y, r});
	}
	sort(ALL(Ps));
	/*
	rep(i,n){
		int a = Ps[i].x;//x
		int b = Ps[i].y;//y
		int r = Ps[i].r;
		cout << a << " " << b << " " << r << endl;
	}
	*/
	rep(i,n){
		int x = Ps[i].x;
		int y = Ps[i].y;
		int id = Ps[i].id;
		if(i == 0) ans[id] = {0, 0, x+1, y+1};
		else if(i == n-1) ans[id] = {x, y, XMAX, YMAX};
		else ans[id] = {x, y, x+2, y+2};
	}
	rep(i,n){
		COUT(ans[i]);
	}
}