#include <bits/stdc++.h>

using namespace std;

const char ord[][10] = {
    "pre-meiji",
    "meiji",
    "taisho",
    "showa",
    "heisei"
};

int main() {
    int y, m, d;
    while (scanf("%d %d %d", &y, &m, &d) != EOF) {
        int ans, ny;
        if (y >= 1989) {
            ans = 4;
            if (y == 1989 && m == 1 && d < 8) ans = 3;
        } else if (y >= 1926) {
            ans = 3;
            if (y == 1926 && ((m < 12) || (m == 12 && d < 25))) ans = 2;
        } else if (y >= 1912) {
            ans = 2;
            if (y == 1912 && ((m < 7) || (m == 7 && d < 30))) ans = 1;
        } else if (y >= 1868) {
            ans = 1;
            if (y == 1868 && ((m < 9) || (m == 9 && d < 8))) ans = 0;
        }

        switch (ans) {
            case 1: y -= 1868; break;
            case 2: y -= 1912; break;
            case 3: y -= 1926; break;
            case 4: y -= 1989; break;
        }

        if (ans) printf("%s %d %d %d\n", ord[ans], ++y, m, d);
        else printf("%s\n", ord[ans]);
    }

    return 0;
}
