#include <stdio.h>

void era(int year, int mon, int day);

int main(void)
{
    int year, mon, day;
    while(scanf("%d %d %d", &year, &mon, &day) != EOF) {
        era(year, mon, day);
    }
}

void era(int year, int mon, int day)
{
    int m, t, s, h;
    int date;
    m = year - 1867;
    t = year - 1911;
    s = year - 1925;
    h = year - 1988;
    date = year * 10000 + mon * 100 + day;
    if (date < 18680908) {
        printf("pre-meiji\n");
    } else if (date < 19120730) {
        printf("meiji %d %d %d\n", m, mon, day);
    } else if (date < 19261225) {
        printf("taisho %d %d %d\n", t, mon, day);
    } else if (date < 19890108) {
        printf("showa %d %d %d\n", s, mon, day);
    } else {
        printf("heisei %d %d %d\n", h, mon, day);
    }
}