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

float satisfaction(float x, float y, float a,
                   float b, float c, float d, float r){
  if(a <= x+0.5 && x+0.5 <= c && b <= y+0.5 && y+0.5 <= d){
    float s = (c-a)*(d-b);
    return 1 - std::pow(1-min(r,s)/max(r,s), 2.0);
  }else{
    return 0;
  }
}

bool check(float a, float b, float c, float d, float r){
  float s = (c-a)*(d-b);
  return s == r;
}

int main(){
  int n;
  cin >> n;
  vector<float> x(n), y(n), r(n), a(n), b(n), c(n), d(n);
  for (int i=0;i<n;i++){
    cin >> x.at(i) >> y.at(i) >> r.at(i);
    a.at(i) = x.at(i);
    b.at(i) = y.at(i);
    c.at(i) = x.at(i)+1;
    d.at(i) = y.at(i)+1;
  }
  /*float sum_p = 0;
  for (int i=0;i<n;i++){
    sum_p = sum_p + 
      satisfaction(x.at(i),y.at(i),
                   a.at(i),b.at(i),
                   c.at(i),d.at(i),r.at(i)); 
  }
  cout << sum_p << endl;*/
  for (int i=0;i<n;i++){
    cout << a.at(i) << " ";
    cout << b.at(i) << " ";
    cout << c.at(i) << " ";
    cout << d.at(i) << endl;
  }
}
/**
*    author:  shu8Cream
*    created: 06.03.2021 11:57:11
**/

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using P = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<tuple<int,int,int>> xyr(n);
    vector<tuple<int,int,int,int,int>> ans(n);
    rep(i,n){
        int x,y,r;
        cin >> x >> y >> r;
        xyr[i]={x,y,i};
    }
    
    int prex = 0, prey = 0, prer = 0;
    sort(all(xyr));
    rep(i,n){
        int x,y,r;
        tie(x,y,r)=xyr[i];
    }
    rep(i,n){
        int x,y,r;
        tie(x,y,r)=xyr[i];
        if(prex-1==x){
            ans[i-1]={prer,x,prey,x+1,prey+1};
            ans[i]={r,x,y,x+1,y+1};
        }else{
            ans[i]={r,prex, 0, x+1, 10000};
        }
        prex=x+1;
        prey=y;
        prer=r;
    }

    sort(all(ans));
    rep(i,n){
        int r,a,b,c,d;
        tie(r,a,b,c,d)=ans[i];
        printf("%d %d %d %d\n", a,b,c,d);
    }
}