#include<stdio.h>
#define TMAX 100000
int main(void){
	int N, T, time[TMAX], in, out, max=0, full=0, i, j;
	scanf("%d%d", &N, &T);
	for(i=0; i<N; i++){
		scanf("%d%d", &in, &out);
		if(0 != in || 100000 != out){
			for(j=in; j<out; j++){
				*(time+j) += 1;
			}
		}else{
			full++;
		}
	}
	for(j=0; j<T; j++){
		max = (max < *(time+j) ? *(time+j) : max);
		printf("%6d %6d %6d\n", j, *(time+j), max);	//
	}
	puts("--------------------");	//
	printf("       %6d\n", max+full);	//
	return 0;
}