#include <algorithm>
#include <vector>
#include <string>

#include <cstdio>
#include <cstring>
#include <cmath>

using namespace std;

const int MAXN = 100100;
const int off = 1 << 17;

int n, L;

int starts[ MAXN ];
pair< int, int > splav[ MAXN ];

struct node {
    int eat[2];
    int run[2][2];
} T[ 2*off ];

void update( int x )
{
    int side = splav[x].second;
    x += off;
    T[x].eat[side] = 1;
    swap( T[x].run[side][side], T[x].run[side][side^1] );

    for( x /= 2; x > 0; x /= 2 ) {
        for( int i = 0; i < 2; ++i ) {
            int mid = T[2*x].eat[i] & 1;
            T[x].eat[i] = T[2*x].eat[i] + T[2*x+1].eat[i^mid];

            for( int j = 0; j < 2; ++j )
                T[x].run[i][j] = T[2*x].run[i][j] + T[2*x+1].run[i^mid][j];
        }
    }
}

int main( void )
{
    scanf( "%d %d", &n, &L );

    for( int i = 0; i < n; ++i ) {
        scanf( "%d %d", &splav[i].second, &splav[i].first );
        starts[i] = splav[i].first;
        --splav[i].second;
    }

    splav[ n++ ] = pair< int, int >( 0, 1 );
    sort( splav, splav + n );
    splav[n] = pair< int, int >( L, 0 );

    for( int i = 0; i < n; ++i )
        for( int j = 0; j < 2; ++j )
            T[i+off].run[j][j] = splav[i+1].first - splav[i].first;

    for( int i = off-1; i > 0; --i )
        for( int j = 0; j < 2; ++j )
            T[i].run[j][j] = T[2*i].run[j][j] + T[2*i+1].run[j][j];

    for( int i = 0; i < n-1; ++i ) {
        update( lower_bound( splav, splav + n, pair< int, int >( starts[i], 0 ) ) - splav );
        printf( "%d %d %d\n", T[1].run[0][0], T[1].run[0][1], T[1].eat[0] );
    }

    return 0;
}

