#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <climits>

#define rep(i, n) for(int i = 0; i < n; i++)
#define per(i, n) for(int i = n - 1; i >= 0; i--)
using ll = long long;
using ld = long double;
#define vi vector<int>
#define vvi vector<vi>
#define vl vector<ll>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define all(a) (a).begin(), (a).end()
#define mod 100000
using namespace std;
const int h = 10000, w = 10000;
vi tate(h);
int n;
//r, y, x
struct status {
  int y = 0, x = 0, r = 0;
  int pos = 0;
  friend bool operator<(const status &a, const status &b){
    return a.r < b.r;
  }
};
struct rect {
  int left, top, right, bottom;
  rect(int a=0, int b=0, int c=0, int d=0) : left(a), top(b), right(c), bottom(d){};
  friend ostream &operator<<(ostream &os, const rect &a){
    return os << a.left << " " << a.top << " " << a.right << " " << a.bottom;
  }
};
vector<status> info;
//y, x
vector<rect> results;

void solve(){
  rep(i, n){
    //if(tate[info[i].y] > 1)
    results[info[i].pos] = rect(info[i].x, info[i].y, info[i].x + 1, info[i].y + 1);
  }
}



void output(){
  rep(i, n){
    cout << results[i] << "\n";
  }
}
void inputs(){
  cin >> n;
  info.resize(n);
  results.resize(n);
  rep(i, n){
    cin >> info[i].x >> info[i].y >> info[i].r;
    info[i].pos = i;
    tate[info[i].y]++;
  }
}
int main(){
  inputs();
  //小さい面積を優先的にやらないと,損失が大きくなってしまう
  sort(all(info));
  solve();
  //cout << "\n\n\n\n\n\n\n\n\n\n\n\n";
  output();
}
#include <iostream>
#include <unordered_set>
#include <vector>

int main() {
    std::vector<std::vector<bool>> field(10000, std::vector<bool>(10000));
    int n;
    std::cin >> n;
    struct ad_rect {
        int x, y, r, x1, y1, x2, y2;
    };
    std::vector<ad_rect> ads(n);
    for (int i {0}; i < n; ++i) {
        std::cin >> ads[i].x >> ads[i].y >> ads[i].r;
        field[ads[i].x][ads[i].y] = 1;
        ads[i].x1 = ads[i].x;
        ads[i].x2 = ads[i].x + 1;
        ads[i].y1 = ads[i].y;
        ads[i].y2 = ads[i].y + 1;
    }

    /**
    *** whether the ad should be expanded
    **/
    auto check1 = [&](ad_rect a) {
        return (a.x2 - a.x1) * (a.y2 - a.y1) >= a.r;
    };

    /**
    *** whether the ad be overlapped
    **/
    auto check2 = [&](int ms) {
        for (int i {0}; i < n; ++i) {
            if (i == ms) continue;
            if (ads[ms].x >= ads[i].x && ads[ms].y >= ads[i].y &&
                    ads[ms].x1 < ads[i].x2 && ads[ms].y1 < ads[i].y2) {
                return true;
            }
            if (ads[ms].x >= ads[i].x && ads[ms].y <= ads[i].y &&
                    ads[ms].x1 < ads[i].x2 && ads[ms].y2 > ads[i].y1) {
                return true;
            }
            if (ads[ms].x <= ads[i].x && ads[ms].y <= ads[i].y &&
                    ads[ms].x2 > ads[i].x1 && ads[ms].y2 > ads[i].y1) {
                return true;
            }
            if (ads[ms].x <= ads[i].x && ads[ms].y >= ads[i].y &&
                    ads[ms].x2 > ads[i].x1 && ads[ms].y1 < ads[i].y2) {
                return true;
            }
        }
        return false;
    };

    bool flag {true};
    int cnt {0};
    std::unordered_set<int> s;
    while (flag) {
        flag = false;
        for (int i {0}; i < n; ++i) {
            if (s.count(i)) continue;
            if (check1(ads[i])) {
                s.insert(i);
                continue;
            }
            if (ads[i].x1 - 1 >= 0) {
                --ads[i].x1;
                if (check2(i)) {
                    ++ads[i].x1;
                } else {
                    flag = true;
                }
            }
            if (check1(ads[i])) {
                s.insert(i);
                continue;
            }
            if (ads[i].y1 - 1 >= 0) {
                --ads[i].y1;
                if (check2(i)) {
                    ++ads[i].y1;
                } else {
                    flag = true;
                }
            }
            if (check1(ads[i])) {
                s.insert(i);
                continue;
            }
            if (ads[i].x2 + 1 < 10000) {
                ++ads[i].x2;
                if (check2(i)) {
                    --ads[i].x2;
                } else {
                    flag = true;
                }
            }
            if (check1(ads[i])) {
                s.insert(i);
                continue;
            }
            if (ads[i].y2 + 1 < 10000) {
                ++ads[i].y2;
                if (check2(i)) {
                    --ads[i].y2;
                } else {
                    flag = true;
                }
            }
        }
    }
    //out
    for (int i {0}; i < n; ++i) {
        std::cout << ads[i].x1 << " " << ads[i].y1 << " " <<
            ads[i].x2 << " " << ads[i].y2 << std::endl;
    }
}
