#include <iostream>
#include <vector>
#include <cstdlib>
#include <string>
using namespace std;

int main ()
{
    string y,m,d;
    while (cin >> y >> m >> d) {
        string str;
        int i = 0;
        while (4 - y.size() > i++) str += '0'; str += y; i=0;
        while (2 - m.size() > i++) str += '0'; str += m; i=0;
        while (2 - d.size() > i++) str += '0'; str += d; i=0;
        if (str < "18680908") cout << "pre-meiji" << endl;
        else if (str < "19120730") cout << "meiji " << atoi(y.c_str()) - 1867 << " " << m << " " << d << endl;
        else if (str < "19261225") cout << "taisho " << atoi(y.c_str()) - 1911 << " " << m << " " << d << endl ;
        else if (str < "19890108") cout << "showa " << atoi(y.c_str()) - 1925 << " " << m << " " << d << endl;
        else cout << "heisei " << atoi(y.c_str()) - 1988 << " " << m << " " << d << endl;
    }

    return 0;
}