public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String line = "";
		StringBuilder out = new StringBuilder();
		int[] h = new int[10001];
		while ((line = in.readLine()) != null && line.length() != 0){
			int[] info = readInts(line);
			for (int i = info[0]; i < info[2]; i++) 
				h[i] = Math.max(h[i], info[1]);
		}
		int curH = 0;
		boolean first = true;
		for (int i = 0; i < h.length; i++) 
			if(h[i]!=curH){
				if(!first)
					out.append(" ");
				first = false;
				out.append(i+" "+h[i]);
				curH = h[i];
			}
		System.out.println(out);
	}