#include <iostream>
#include <string>
#include <cstdio>
#include <cstdlib>

using namespace std;

int main()
{
        const int DATE[] = {18680907, 19120729, 19261224, 19890107};
        const int YEAR[] = {1868, 1912, 1926, 1989};
        const string ERA[] = {"meiji", "taisho", "showa", "heisei"};
        int y, m, d;
        char dt[9];

        while (cin >> y >> m >> d) {
                sprintf(dt, "%d%02d%02d", y, m, d);
                dt[8] = '\0';
                int date = atoi(dt);
                if (date <= DATE[0]) {
                        cout << "pre-meiji";
                } else {
                        int idx = 0;
                        while (idx < 4 && date > DATE[idx]) {
                                idx++;
                        }
                        cout << ERA[idx - 1];
                        int era = y - YEAR[idx - 1] + 1;
                        cout << " " << era << " " << m << " " << d;
                }
                cout << '\n';
        }

        return 0;
}