/*
    2014.07.04 1313~1326
    2014.07.04 1451~
    C language Lecture week 4
*/

#include <stdio.h>
#include <string.h>

#define ES_max 32 // Era string max length
    // heisei_2014_12_31
    //     *    1    *    2    *    3    *    4

typedef struct Date {
    int year;
    int month;
    int date;
} Date;

void Year2EraTranslate ( char* out, Date In );
int DateCmp ( Date In1, Date In2 );

// 変えないので高速化の意味でもグローバルで定義しておく
// Constにしようかとも考えたが面倒くさくなった
Date Meiji  = { 1868,  9,  8 };
Date Taisho = { 1912,  7, 30 };
Date Showa  = { 1926, 12, 25 };
Date Heisei = { 1989,  1,  8 };

int main (void) {
    
    char erastr[ES_max];
    Date Input;
    
    while (1) {
        if ( scanf ( "%d", &Input.year ) == EOF ) {
            break;
        }
        scanf ( "%d", &Input.month );
        scanf ( "%d", &Input.date );
        Year2EraTranslate ( (char *) erastr, Input );
        printf ( "%s", erastr );
    }
    
    return 0;
    
}

void Year2EraTranslate ( char* out, Date In ) {
    
    if ( DateCmp ( In, Meiji ) == -1 ) {
        out = (char*) "pre-meiji\n";                       // 明治以前
    } else if ( DateCmp ( In, Taisho ) == -1 ) {
        sprintf ( (char*) out, "meiji %d %d %d\n",  ( In.year -  Meiji.year ), In.month, In.date );    // 明治
    } else if ( DateCmp ( In, Showa ) == -1 ) {
        sprintf ( (char*) out, "taisho %d %d %d\n", ( In.year - Taisho.year ), In.month, In.date );    // 大正
    } else if ( DateCmp ( In, Heisei ) == -1 ) {
        sprintf ( (char*) out, "showa %d %d %d\n",  ( In.year -  Showa.year ), In.month, In.date );    // 昭和
    } else {
        sprintf ( (char*) out, "heisei %d %d %d\n", ( In.year - Heisei.year ), In.month, In.date );    // 平成
    }
    
    return;
    
}

int DateCmp ( Date In1, Date In2 ){
    // Compare Date In1 and In2
    // If In1 < In2 then return -1
    // If In1 = In2 then return 0
    // if In1 > In2 then return 1
    
    if ( In1.year == In2.year ) {
        if ( In1.month == In2.month ) {
            if ( In1.date == In2.date ) {
                return 0;
            } else {
                if ( In1.date < In2.date ) {
                    return -1;
                } else {
                    return 1;
                }
            }
        } else {
            if ( In1.month < In2.month ) {
                return -1;
            } else {
                return 1;
            }
        }
    } else {
        if ( In1.year < In2.year ) {
            return -1;
        } else {
            return 1;
        }
    }
    
}