1 #include <iostream>
   2 #include <sstream>
   3 #include <string>
   4 #include <algorithm>
   5 #include <vector>
   6 using namespace std;
   7 
   8 #define GI ({int _t; scanf("%d", &_t); _t;})
   9 #define FOR(i, a, b) for (int i=a; i<b; i++)
  10 #define REP(i, a) FOR(i, 0, a)
  11 #define pb push_back
  12 template<class T> string toString(T n){ostringstream ost;ost<<n;ost.flush();return ost.str();}
  13 int toInt(string s){int r=0;istringstream sin(s);sin>>r;return r;}
  14 #define DBG(x) cout << #x << "::" << x << endl;
  15 #define DBGV(_v) { REP(_i, _v.size()) { cout << _v[_i] << "\t";} cout << endl;}
  16 #define LIMIT 10005
  17 int axis[LIMIT];
  18 
  19 int main() {
  20 	vector <int> l, h, r;
  21 	int end=-1, height=0, a, b, c;
  22 	while (scanf("%d%d%d", &a, &b, &c) != -1) {
  23 		l.pb(a); h.pb(b); r.pb(c);
  24 	}
  25 	REP(i, l.size()) {
  26 		FOR(j, l[i], r[i]) {
  27 			axis[j] = max(axis[j], h[i]);
  28 		}
  29 	}
  30 	bool first = true;
  31 	FOR(i, 0, LIMIT) {
  32 		if (axis[i] != axis[i-1]) {
  33 			if (first == false) printf(" ");
  34 			printf("%d %d", i, axis[i]);
  35 			first = false;
  36 		}
  37 	}
  38 	printf("\n");
  39 	return 0;
  40 }