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

#define rep(i, a, b) for (int i = (int)(a); (i) < (int)(b); (i)++)
#define rrep(i, a, b) for (int i = (int)(b) - 1; (i) >= (int)(a); (i)--)
#define all(v) v.begin(), v.end()

typedef long long ll;
template <class T> using V = vector<T>;
template <class T> using VV = vector<V<T>>;

/* 提出時これをコメントアウトする */
// #define LOCAL true

#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl
#else
#define dbg(x) true
#endif

struct P{
    int x, y, r, id;
    P(int x=0, int y=0, int r=0, int id=0) : x(x), y(y), r(r), id(id) {}
    bool operator <(const P& other) const {
        return r < other.r;
    }
};

struct S{
    int a,b,c,d,id;
    S(int a=0, int b=0, int c=0, int d=0, int id=0) :a(a),b(b),c(c),d(d),id(id) {}
};

struct Point {
    int x, y;
    Point(int x=0, int y=0) : x(x),y(y) {}
    bool operator <(const Point& other) const {
        if (y != other.y) return y < other.y;
        return x < other.x;
    }
};

auto solve (int n, V<P>& v) -> V<S> {
    // 面積が小さいほうから見る
    sort(all(v));

    V<S> ret(n);
    set<Point> st;

    // version 1: (x,y), (x+1,y+1)
    rep(i,0,n) {
        ret[i] = S(v[i].x,v[i].y,v[i].x+1,v[i].y+1,v[i].id);
        st.insert(Point(v[i].x,v[i].y));
    }

    // version 2: 横だけに伸ばす
    // => cをできるだけ大きくする
    rep(i,0,n) {
        int c = ret[i].c;
        int d = ret[i].d;
        while (!st.count(Point(c,d-1)) && c < 10000) {
            if (c - ret[i].a >= v[ret[i].id].r) break;
            c++;
        }
        ret[i].c = c;
    }

    return ret;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    constexpr char endl = '\n';
    
    // input
    int n;
    cin >> n;
    V<P> v(n);
    rep(i,0,n) {
        cin >> v[i].x >> v[i].y >> v[i].r;
        v[i].id = i;
    }

    // solve
    auto ans = solve(n, v);

    // output
    V<int> a(n),b(n),c(n),d(n);
    rep(i,0,n) {
        a[ans[i].id] = ans[i].a;
        b[ans[i].id] = ans[i].b;
        c[ans[i].id] = ans[i].c;
        d[ans[i].id] = ans[i].d;
    }
    rep(i,0,n) {
        cout << a[i] << " " << b[i] << " " << c[i] << " " << d[i] << endl;
    }
    return 0;
}
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0; i<(int)(n); i++)
int main(){
int n; cin >> n; int x[n], y[n], r[n];
REP(i, n){ cin >> x[i] >> y[i] >> r[i]; }
vector<int> X, Y; unordered_map<int, int> kshtX, kshtY;
REP(i, n){ 
  if(!kshtX[x[i]]){ X.push_back(x[i]); kshtX[x[i]]++; }
  if(!kshtY[y[i]]){ Y.push_back(y[i]); kshtY[y[i]]++; }  
}
sort(X.begin(), X.end()); sort(Y.begin(), Y.end());
int xl=X.size(), yl=Y.size();
map<int, vector< pair<int, int> > > onX, onY;
REP(i, n){ onX[x[i]].push_back(make_pair(y[i], i)); onY[y[i]].push_back(make_pair(x[i], i)); }
REP(i, n){ sort(onX[x[i]].begin(), onX[x[i]].end()); sort(onY[y[i]].begin(), onY[y[i]].end()); }

const int cs=2;
int a[cs][n], b[cs][n], c[cs][n], d[cs][n];
REP(k, cs){ REP(i, n){ a[k][i]=x[i]; b[k][i]=y[i]; c[k][i]=x[i]+1; d[k][i]=y[i]+1; } }

int mae=0;
REP(i, xl){ 
  mae=0;
  REP(j, onX[X[i]].size()){ 
    int e=0, v=onX[X[i]][j].second;
    b[0][v]=max(d[0][v]-r[v], mae);
    if(j==(int)onX[X[i]].size()-1){ e=10000; }else{ e=b[0][onX[X[i]][j+1].second]; }
    d[0][v]=min(b[0][v]+r[v], e); mae=d[0][v];
  } 
}
mae=0;
REP(i, xl){ 
  int sub=0;
  REP(j, onX[X[i]].size()){ 
    int e=0, v=onX[X[i]][j].second, h=d[0][v]-b[0][v], w=r[v]/h;
    a[0][v]=max(c[0][v]-w, mae);
    if(i==xl-1){ e=10000; }else{ e=X[i+1]; }
    c[0][v]=min(a[0][v]+w, e); sub=max(sub, c[0][v]);
  }
  mae=max(mae, sub);
}

REP(i, yl){ 
  mae=0;
  REP(j, onY[Y[i]].size()){ 
    int e=0, v=onY[Y[i]][j].second;
    a[1][v]=max(c[1][v]-r[v], mae);
    if(j==(int)onY[Y[i]].size()-1){ e=10000; }else{ e=a[1][onY[Y[i]][j+1].second]; }
    c[1][v]=min(a[1][v]+r[v], e); mae=c[1][v];
  } 
}
mae=0;
REP(i, yl){ 
  int sub=0;
  REP(j, onY[Y[i]].size()){ 
    int e=0, v=onY[Y[i]][j].second, w=c[1][v]-a[1][v], h=r[v]/w;
    b[1][v]=max(d[1][v]-h, mae);
    if(i==yl-1){ e=10000; }else{ e=Y[i+1]; }
    d[1][v]=min(b[1][v]+h, e); sub=max(sub, d[1][v]);
  }
  mae=max(mae, sub);
}

int l=0, ans=0;
REP(k, cs){ 
  long double s, t, p, q, sc=0;
  REP(i, n){ 
    s=(d[k][i]-b[k][i])*(c[k][i]-a[k][i]); t=r[i]; q=min(s, t)/max(s, t); p=1-(1-q)*(1-q);
    sc+=(1e9*p)/n;
  }
  if(ans<round(sc)){ ans=round(sc); l=k; }
}
REP(i, n){ cout << a[l][i] << " " << b[l][i] << " " << c[l][i] << " " << d[l][i] << "\n"; }

}