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

class Date {
public:
    int y, m, d;
    Date(int y, int m, int d) : y(y), m(m), d(d) {};
    bool operator<(const Date& date) const {
        return y < date.y
                || (y == date.y && m < date.m)
                || (y == date.y && m == date.m && d < date.d);
    }
};

int main() {
    Date meiji(1868,9,8), taisho(1912,7,30), showa(1926,12,25), heisei(1989,1,8);
    int y, m, d;
    while (cin >> y >> m >> d) {
        Date date(y, m, d);
        if (date < meiji) {
            cout << "pre-meiji" << endl;
        } else if (date < taisho) {
            cout << "meiji " << y - meiji.y + 1 << " " << m << " " << d << endl;
        } else if (date < showa) {
            cout << "taisho " << y - taisho.y + 1 << " " << m << " " << d <<endl;
        } else if (date < heisei) {
            cout << "showa " << y - showa.y + 1 << " " << m << " " << d <<endl;
        } else {
            cout << "heisei " << y - heisei.y + 1 << " " << m << " " << d <<endl;
        }
    }
    return 0;
}