#include <bits/stdc++.h>

using namespace std;

int main() {

    int y, m, d;
    int ymd;

    while(cin >> y >> m >> d) {

        ymd = y* 10000 + m * 100 + d;

        if(ymd >= 18680908 && ymd <= 19120729) {
            cout << "meiji" << " " << (ymd / 10000) - 1868 + 1 << " " << m << " " <<  d << endl;
        } else if(ymd >= 19120730 && ymd <= 19261224) {
            cout << "taisho" << " " << (ymd / 10000) - 1912 + 1 << " " << m << " " <<  d << endl;
        } else if(ymd >= 19261225 && ymd <= 19890107) {
            cout << "showa" << " " << (ymd / 10000) - 1926 + 1 << " " << m << " " <<  d << endl;
        } else if(ymd >= 19890108) {
            cout << "heisei" << " " << (ymd / 10000) - 1989 + 1 << " " << m << " " <<  d << endl;
        } else {
            cout << "pre-meiji" << endl;
        }

    }

}