#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ALL(x) (x).begin(), (x).end()
template<class T> bool chmax(T &x, const T &y){if (x < y) {x = y; return true;} return false;}
template<class T> bool chmin(T &x, const T &y){if (x > y) {x = y; return true;} return false;}
template<class T> void print(T x){cout << x << endl;}

class Random{
    public:
    unsigned long x = 123456789;
    unsigned long y = 362436069;
    unsigned long z = 521288629;
    unsigned long w = 88675123;
    unsigned int seed;
    Random(int s){
        z = (z + s * w - s * 123999 + s) % 1000000000;
    }
    Random(){
        return;
    }
    unsigned long g(){
        unsigned long t = (x ^ (x << 11));
        x = y; y = z; z = w;
        return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
    }
};

class Timer{
    public:
        clock_t start;
        Timer(){
            start = clock();
        }

        double gettime(){
            return (double)(clock() - start) / CLOCKS_PER_SEC;
        }

        void set(){
            start = clock();
        }
};

class AtCoderAd{
    public:
    int N;
    vector<vector<int>> R;
    vector<vector<bool>> used;
    AtCoderAd(int n, vector<vector<int>> req){
        N = n;
        R = req;
        used.resize(10000, vector<bool>(10000, false));
    }

    double p(int r, int s){
        double x = (1.0 - min(r, s)) / max(r, s);
        return 1 - x * x;
    }
    
    vector<vector<int>> solve(){
        vector<vector<int>> ret(N, vector<int>(4, 0));
        int x, y;
        for (int i = 0; i < N; i++){
            x = R[i][0];
            y = R[i][1];
            if (used[x][y]) continue;
            used[x][y] = true;
            ret[i] = {x, y, x + 1, y + 1};
        }
        return ret;
    }
};

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    vector<vector<int>> req(n, vector<int>(3));
    for (int i = 0; i < n; i++){
        cin >> req[i][0] >> req[i][1] >> req[i][2];
    }

    AtCoderAd solver = AtCoderAd(n, req);
    vector<vector<int>> ans = solver.solve();
    for (int i = 0; i < n; i++){
        cout << ans[i][0] << " " << ans[i][1] << " " << ans[i][2] << " " << ans[i][3] << endl;
    }
    return 0;
}
#include <bits/stdc++.h>
using namespace std;
//int x[100007], y[100007], r[100007];
struct nod{
	int x, y, r;
}a[207];
int n;
int main(){
	scanf("%d", &n);
	for(int i = 0; i < n; i++){
		scanf("%d %d %d", &a[i].x, &a[i].y, &a[i].r);
	}
	for(int i = 0; i < n; i++){
		printf("%d %d %d %d\n", a[i].x, a[i].y, a[i].x + 1, a[i].y + 1);
	}
	return 0;
}