#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
const int RANGEMAX = 10000;
struct record{
    int id;
    int x;
    int y;
    int r;
    bool operator<(const record &other) const {
        return this->r < other.r;
    }
    bool operator>(const record &other) const {
        return this->r > other.r;
    }
};

int input(vector<int> &x, vector<int> &y, vector<int> &r){
    int n;
    cin >> n;
    x = vector<int>(n);
    y = vector<int>(n);
    r = vector<int>(n);
    for(int i = 0; i < n; i++) cin >> x[i] >> y[i] >> r[i];
    return n;
}

void output(int n, const vector<int> &a, const vector<int> &b, const vector<int> &c, const vector<int> &d){
    for(int i = 0; i < n; i++){
        cout << a[i] << " " << b[i] << " " << c[i] << " " << d[i] << endl;
    }
}

// 入出力 AC Score: 823090
void solve001(int n, vector<int> x, vector<int> y, vector<int> r){
    vector<vector<bool>> isused(RANGEMAX, vector<bool>(RANGEMAX, false));
    vector<int> a(n, -1), b(n, -1), c(n, -1), d(n, -1);
    vector<record> data(n);
    for(int i = 0; i < n; i++){
        data[i] = {i, x[i], y[i], r[i]};
    }
    sort(data.begin(), data.end(), greater<record>());
    for(int curind = 0; curind < n; curind++){
        int id = data[curind].id;
        int oneSideLen = (int)sqrt(r[id]);// 1辺の長さ
        
        for(int i = x[id]; i < min(x[id]+oneSideLen, RANGEMAX); i++){
            for(int j = y[id]; j < min(y[id]+oneSideLen, RANGEMAX); j++){
                if(isused[i][j] && i > x[id] && j > y[id]){
                    a[id] = x[id];
                    b[id] = y[id];
                    c[id] = i-1;
                    d[id] = j-1;
                    goto EndMakeRectLoop;
                }else if(isused[i][j] && (i == x[id] && j == y[id])){
                    goto EndMakeRectLoop;
                }
            }
        }
        EndMakeRectLoop:
        if(a[id] != -1){
            for(int i = a[id]; i < c[id]; i++){
                for(int j = b[id]; j < d[id]; j++) isused[i][j] = true;
            }
        }
    }
    for(int curind = 0; curind < n; curind++){
        if(a[curind] != -1) continue;

        for(int i = 0; i < RANGEMAX; i++){
            for(int j = 0; j < RANGEMAX; j++){
                if(!isused[i][j]){
                    isused[i][j] = true;
                    a[curind] = i;
                    b[curind] = j;
                    c[curind] = i+1;
                    d[curind] = j+1;
                    goto EndMakeRectLoop2;
                }
            }
        }
        EndMakeRectLoop2:
        ;
    }
    output(n, a, b, c, d);
}

int main(){
    int n;
    vector<int> x, y, r;
    n = input(x, y, r);
    solve001(n, x, y, r);
    return 0;
}
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<(x)<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

// constexpr ll MOD=1000000007ll;
constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int n, x[252], y[252], r[252];

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  // cout<<setprecision(10)<<fixed;
  cin>>n;
  REP(i, n){
    cin>>x[i]>>y[i]>>r[i];
  }
  REP(i, n){
    cout<<i*(10000/n)<<' '<<0<<' '<<(i+1)*(10000/n)<<' '<<10000<<'\n';
  }
  return 0;
}
