#include<stdio.h>
#include<stdbool.h>

#define Pre 0//for switch
#define Meiji 1
#define Taisho 2
#define Showa 3
#define Heisei 4

//declare function
void changegengo(int nen,int tuki, int hi);

/*==============end of delaration====================================*/

int main(void){
    int impyear;
    int impmonth;
    int impday;
    while(scanf("%d %d %d", &impyear, &impmonth, &impday) != EOF) {
        changegengo(impyear, impmonth, impday);
    }
    return 0;
}

void changegengo(int nen,int tuki,int hi) {
    int gengo;
    //judging statement
    if(nen > 1989 ||
      (nen == 1989 && (tuki > 1 
                   || (tuki == 1 && hi >= 8)))) {
        gengo = Heisei;

    }else if(nen > 1926 ||
            (nen == 1926 && (tuki > 12 || 
                            (tuki == 12 && hi >= 25)))) {
        gengo = Showa;
    }else if(nen > 1926 ||
            (nen == 1926 && (tuki > 7 ||
                             (tuki == 7 && hi >= 30)))) {
        gengo = Taisho;
    }else if(nen > 1868 ||
            (nen == 1868 && (tuki > 9 ||
                             (tuki == 9 && hi >= 8)))) {
        gengo = Meiji;
    }else{
        gengo = Pre;
    }

    //printing statement
    switch(gengo) {
        case Pre:
            printf("pre-meiji\n");
            break;
        case Meiji:
            printf("meigi %d %d\n", tuki, hi);
            break;
        case Taisho:
            printf("taisho %d %d\n", tuki, hi);
            break;
        case Showa:
            printf("showa %d %d\n", tuki, hi);
            break;
        case Heisei:
            printf("heisei %d %d\n", tuki, hi);
            break;
    }
}