#include <cstdio>

using namespace std;

int y,m,d;

int main()
{
    while( scanf( "%d %d %d\n", &y, &m, &d ) != EOF )
    {
        int num = y * 10000 + m * 100 + d;
        if( num < 18680908 )
        {
            printf( "pre-meiji\n" );
        }
        else if( num < 19120730 )
        {
            printf( "meiji %d %d %d\n", y - 1867, m, d );
        }
        else if( num < 19261225 )
        {
            printf( "taisho %d %d %d\n", y - 1911, m, d );
        }
        else if( num < 19890108 )
        {
            printf( "syowa %d %d %d\n", y - 1925, m, d );
        }
        else if( 19890108 < num )
        {
            printf( "heisei %d %d %d\n", y - 1988, m, d );
        }
    }
    return 0;
}
