#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;
    m = year - 1867;
    t = year - 1911;
    s = year - 1925;
    h = year - 1988;
    if (year < 1868 || (year == 1868 && mon < 9) || (year == 1868 && mon < 9 && day < 8)) {
        printf("pre-meiji\n");
    } else if (year < 1912 || (year == 1912 && mon < 30) || (year == 1912 && mon < 7 && day < 30)) {
        printf("meiji %d %d %d\n", m, mon, day);
    } else if (year < 1926 || (year == 1926 && mon < 12) || (year == 1926 && mon < 12 && day < 25)) {
        printf("taisho %d %d %d\n", t, mon, day);
    } else if (year < 1989 || (year == 1989 && mon < 1) || (year == 1989 && mon < 1 && day < 8)) {
        printf("showa %d %d %d\n", s, mon, day);
    } else {
        printf("heisei %d %d %d\n", h, mon, day);
    }
}