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


const int year[4] = {1868, 1912, 1926, 1989};
const int month[4] = {9, 7, 12, 1};
const int day[4] = {8, 30, 25, 8};
const char gengou[5] = {'p', 'm', 't', 's', 'h'};

char gengouka (int inputyear)
{
    int i;
    char y;
    for (i = 0; i < 3; ++i) {
        if (inputyear < year[i]) {
            y = gengou[i];
            break;
        } else if (inputyear > year[3]) {
            y = gengou[4]; 
            break;
        }
    }
    return y;
}

int main(void) 
{
    while (true) {
        int inputyear, month, day, outputyear;
        scanf("%d %d %d", &inputyear, &month, &day);
        char y = gengouka(inputyear);
        if (y == 'p') {
            printf("pre-meiji\n");
        } else if (y == 'm') {
            outputyear = inputyear - year[0] + 1;
            printf("meiji %d %d %d\n", outputyear, month, day);
        } else if (y == 't') {
            outputyear = inputyear - year[1] + 1;
            printf("taisyou %d %d %d\n", outputyear, month, day); 
        } else if (y == 's') {
            outputyear = inputyear - year[2] + 1;
            printf("syowa %d %d %d\n", outputyear, month, day);
        } else {
            outputyear = inputyear - year[3] + 1;
            printf("heisei %d %d %d\n", outputyear, month, day);
        }
    } 
    return 0;
}