#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define rep1(i, n) for(int i=1; i<=(int)(n); i++)
#define rep2(i, n, m) for(int i=(int)n; i<=(int)m; i++)
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> wi;
typedef vector<ll> vl;
const ll inf=1LL<<60;
const ll mod=1000000007;

inline void InitRnd(){
  srand((unsigned int)time(NULL));
}

int n;
vector<tuple<int, int, int, int>> s(210);

bool checker(int a, int b, int c, int d, int j){
  rep(i, n){
    if(i==j)continue;
    int e, f, g, h;
    tie(e, f, g, h)=s[i];
    int sw=c-a, sh=d-b, tw=g-e, th=h-f, dx=e-a, dy=f-b;
    if(-tw<dx&&dx<sw&&-th<dy&&dy<sh)return false;
  }
  return true;
}

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

  InitRnd();

  cin >> n;
  vi x(n), y(n), r(n);
  rep(i, n){
  	cin >> x[i] >> y[i] >> r[i];
  	s[i]={x[i], y[i], x[i]+1, y[i]+1};
  }

  vector<bool> ok(n, false), ok0(n, false), ok1(n, false), ok2(n, false), ok3(n, false);
  int cnt=0;
  while(true){
    rep(i, n){
      if(ok[i])continue;
      int a, b, c, d;
      tie(a, b, c, d)=s[i];
      int t=(c-a)*(d-b);
      if(checker(a-1, b, c, d, i)&&a-1>=0&&!ok0[i]){
        if(t-r[i]>t-r[i]+d-b){
          cnt++;
          ok0[i]=true;
        }
        else s[i]=make_tuple(a-1, b, c, d);
      }
      else if(checker(a, b-1, c, d, i)&&b-1>=0&&!ok1[i]){
        if(t-r[i]>t-r[i]+c-a){
          cnt++;
          ok1[i]=true;
        }
        else s[i]=make_tuple(a, b-1, c, d);
      }
      else if(checker(a, b, c+1, d, i)&&c+1<=10000&&!ok2[i]){
        if(t-r[i]>t-r[i]+d-b){
          cnt++;
          ok2[i]=true;
        }
        else s[i]=make_tuple(a, b, c+1, d);
      }
      else if(checker(a, b, c, d+1, i)&&d+1<=10000&&!ok3[i]){
        if(t-r[i]>t-r[i]+c-a){
          cnt++;
          ok3[i]=true;
        }
        else s[i]=make_tuple(a, b, c, d+1);
      }
      else{
        cnt++;
        ok[i]=ok0[i]=ok1[i]=ok2[i]=ok3[i]=true;
      }
      if(ok0[i]&&ok1[i]&&ok2[i]&&ok3[i])ok[i]=true;
    }
    if(cnt>=n)break;
  }

  rep(i, n){
  	int a, b, c, d;
  	tie(a, b, c, d)=s[i];
  	cout << a << " " << b << " " << c << " " << d << endl;
  }

  return 0;
}
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <sstream>
#include <tuple>
#include <vector>

using namespace std;
using namespace chrono;

#ifdef DEBUG
	#define LOCAL_INPUT_FILE
#else
	//~ #define USE_FILE_IO
#endif

#ifdef USE_FILE_IO
	#define INPUT_FILE "input.txt"
	#define OUTPUT_FILE "output.txt"
	#define cin ____cin
	#define cout ____cout
	ifstream cin(INPUT_FILE);
	ofstream cout(OUTPUT_FILE);
#else
	#ifdef LOCAL_INPUT_FILE
		#define cin ____cin
		ifstream cin("input.txt");
	#endif
#endif

const int infinity = (int)1e9 + 42;
const int64_t llInfinity = (int64_t)1e18 + 256;
const int module = (int)1e9 + 7; 
const long double eps = 1e-8;

mt19937_64 randGen(system_clock().now().time_since_epoch().count());

inline void raiseError(string errorCode) {
	cerr << "Error : " << errorCode << endl;
	exit(42);
}

inline bool check(vector< pair<int, int> > trans) {
	int n = trans.size();
	for (int beg = 0; beg < n; ++beg) {
		vector<int> d(n, -1);
		d[beg] = 0;
		queue<int> q;
		q.push(beg);
		while (!q.empty()) {
			int v = q.front(); q.pop();
			for (int to : {trans[v].first, trans[v].second}) {
				if (d[to] < 0) {
					q.push(to);
					d[to] = d[v] + 1;
				}
			}
		}
		for (int i : d) {
			if (i > 10 || i < 0) {
				return false;
			}
		}
	}
	return true;
}

inline vector< pair<int, int> > make(int n) {
	vector< pair<int, int> > trans(n);
	for (int i = 0; i < n; ++i) {
		trans[i].first = (i*2) % n;
		trans[i].second = (i*2+1) % n;
	}
	return trans;
}

signed main() {
	#ifndef USE_FILE_IO
		ios_base::sync_with_stdio(false);
	#endif
	
	int n; cin >> n;
	for (auto [a1, a2] : make(n)) {
		cout << a1+1 << " " << a2+1 << endl;
	}
	
	//~ for (int i = 1; i <= 1000; ++i) {
		//~ if (i % 50 == 0) {
			//~ cout << "Check " << i << endl;
		//~ }
		//~ auto trans = make(i);
		//~ if (!check(trans)) {
			//~ cout << "bad at " << i << endl;
		//~ }
	//~ }
	
	return 0;
}
