#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define BUFF ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define IO freopen("in.txt","r",stdin),freopen("out.txt","w",stdout)
#define P(x) cout<<x<<endl
#define P2(x,y) cout<<x<<' '<<y<<endl
#define P3(x,y,z) cout<<x<<' '<<y<<' '<<z<<endl
#define P4(x,y,z,u) cout<<x<<' '<<y<<' '<<z<<' '<<u<<endl
#define P5(x,y,z,u,v) cout<<x<<' '<<y<<' '<<z<<' '<<u<<' '<<v<<endl
#define P6(x,y,z,u,v,w) cout<<x<<' '<<y<<' '<<z<<' '<<u<<' '<<v<<' '<<w<<endl
#define PV(x) for(auto ii:(x)){cout<<ii<<' ';}cout<<endl
#define PN(x,n) for(int ii=1;ii<=(n);ii++){cout<<x[ii]<<' ';}cout<<endl
#define PNN(x,n,m) for(int ii=1;ii<=(n);ii++){for(int jj=1;jj<=(m);jj++){cout<<x[ii][jj]<<' ';}cout<<endl;}
typedef long long ll;
typedef unsigned long long ull;
const ll D = 0;
const ll N = 222;
const ll mod = 1e9 + 7;
const ll inf = 1e9 + 7;
const double eps = 1e-9;

ll n;
bool visRow[10010];
vector<ll> adInRow[10010];
double score=0;
struct AD
{
	ll id,x,y,r,a,b,c,d;
	bool operator <(const AD &tmp)const
	{
		return y<tmp.y;
	}
}ad[N];
bool cmp(ll id1,ll id2)
{
	return ad[id1].y < ad[id2].y;
}
ll area(ll x,ll y,ll z,ll w)
{
	return abs(x-y) * abs(z-w);
}
int solve()
{
	cin>>n;
	ll maxX=0;
	for(ll i=1;i<=n;i++)
	{
		cin>>ad[i].x>>ad[i].y>>ad[i].r;
		ad[i].id = i;
		//visRow[ad[i].x]=true;
		adInRow[ad[i].x].push_back(i);
		maxX = max(maxX, ad[i].x);
		//P("ok");
	}
	for(ll i=0;i<10000;i++)
	{
		sort(adInRow[i].begin(),adInRow[i].end(),cmp);
	}
	ll lstX=0,lstY=0,cnt,siz;
	for(ll i=0;i<10000;i++)
	{
		if(!adInRow[i].empty())
		{
			cnt=0;
			siz = adInRow[i].size();
			lstY=0;
			for(ll j=0;j<siz;j++)
			{
				AD *now = &ad[adInRow[i][j]];
				now->a = lstY;
				now->b = now->y + 1;
				if(j == siz-1) now->b = 10000;
				lstY = now->b;

				if(i==maxX) now->d = 10000;
				else now->d = now->x + 1;

				ll tmpx = now->x;
				while(tmpx<now->x && area(now->b,now->a,now->d,now->c)<(now->r))
				{
					tmpx--;
				}
				now->c = lstX;//[lstx,nowx]
				
			}
			lstX = i + 1;
		}
	}
	score=0;
	for(ll i=1;i<=n;i++)
	{
		P4(ad[i].a,ad[i].c,ad[i].b,ad[i].d);
		if(D)
		{
			double s = area(ad[i].b,ad[i].a,ad[i].d,ad[i].c);
			double r = ad[i].r;
			score += 1 - pow(1 - (min(r,s)/max(r,s)), 2.);
			//P((min(r,s)/max(r,s)));
		}
	}
	if(D)
	{
		score = 1e9 * (score / n);
		cout<<"Your score: "<<(ll)score;
	}
	
	return 0; 
}

int main()
{
	//BUFF;
	if(D)IO;
	solve();
	return 0;
}
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a, b)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, n) for (ll i = n - 1; i >= 0; i--)

struct Timer {
  private:
    chrono::high_resolution_clock::time_point start, end;

  public:
    Timer() { set(); }
    void set() { start = chrono::high_resolution_clock::now(); }
    int time() {
        end = chrono::high_resolution_clock::now();
        return chrono::duration_cast<chrono::milliseconds>(end - start).count();
    }
    void print() { cerr << "elapsed time: " << (double)time() / 1000 << " sec" << endl; }
};

struct Random {
  private:
    uint32_t a, b, c, d;

  public:
    Random(uint32_t seed = 517) { set_seed(seed); }
    void set_seed(uint32_t seed) {
        a = seed = 1812433253u * (seed ^ (seed >> 30));
        b = seed = 1812433253u * (seed ^ (seed >> 30)) + 1;
        c = seed = 1812433253u * (seed ^ (seed >> 30)) + 2;
        d = seed = 1812433253u * (seed ^ (seed >> 30)) + 3;
    }
    uint32_t operator()() {
        uint32_t t = (a ^ (a << 11));
        a = b;
        b = c;
        c = d;
        return d = (d ^ (d >> 19)) ^ (t ^ (t >> 8));
    }

    // [0,MAX)
    uint32_t operator()(int MAX) { return (uint64_t) operator()() * MAX >> 32; }

    // [L,R)
    uint32_t operator()(int L, int R) { return L + operator()(R - L); }

    // [0,1) の実数
    double drnd() { return (double)operator()() / (1LL << 32); }

    // 確率 p で true を返す
    bool prob(const double p) { return (uint32_t)(p * (1LL << 32)) > operator()(); }
};

double TL = 3500;
double start_temp = 2.5, end_temp = 0;
int main()
{
  Timer T;
  Random rnd;
  int n;
  cin >> n;
  int x[n], y[n], r[n];
  rep(i, n) cin >> x[i] >> y[i] >> r[i];
  int a[n], b[n], c[n], d[n], cnt = 0;
  rep(i,n){
    a[i] = -1;
    int ok = 0, ng = max(1.0, sqrt(r[i])) + 1e-5 + 1;
    while(ng - ok > 1){
      int nr = (ok + ng) / 2;
      rep(k,4){
        int xl = x[i], xr = x[i] + nr*(1+(-2)*(k/2)), yl = y[i], yr = y[i] + nr*(1+(-2)*(k%2));
        if(xl>xr)
          swap(xl, xr);
        if(yl>yr)
          swap(yl, yr);
        int flag = 1;
        if(xl<0||yl<0||xr>10000||yr>10000)
          flag = 0;
        rep(j, i) if (a[j] < xr && c[j] > xl && b[j] < yr && d[j] > yl) flag = 0;
        if(flag){
          a[i] = xl, b[i] = yl, c[i] = xr, d[i] = yr;
          ok = nr;
          break;
        }
        if(k == 3)
          ng = nr;
      }
    }
    if(a[i] == -1){
      while (1){
        int xl = cnt / 10000, yl = cnt % 10000;
        int xr = xl + 1, yr = yl + 1;
        cnt++;
        int flag = 1;
        rep(j, i) if (a[j] < xr && c[j] > xl && b[j] < yr && d[j] > yl) flag = 0;
        if(flag){
          a[i] = xl, b[i] = yl, c[i] = xr, d[i] = yr;
          break;
        }
      }
    }
  }
  rep(i, n) cout << a[i] << " " << b[i] << " " << c[i] << " " << d[i] << endl;
}