#include <iostream>
using namespace std;

int main() {
    
    while (!cin.eof()) {
        int y, m, d, dvalue;
        cin >> y >> m >> d;
        dvalue = y * 10000 + m * 100 + d;
        if (dvalue < 18680908) {
            cout << "pre-meiji";
        }
        else if (18680908 <= dvalue && dvalue <= 19120729) {
            cout << "meiji " << (y - 1868 + 1) << " " << m << " " << d;
        }
        else if (19120730 <= dvalue && dvalue <= 19261224) {
            cout << "taisho " << (y - 1912 + 1) << " " << m << " " << d;
        }
        else if (19261225 <= dvalue && dvalue <= 19890107) {
            cout << "showa " << (y - 1926 + 1) << " " << m << " " << d;
        }
        else {
            cout << "heisei " << (y - 1989 + 1) << " " << m << " " << d;
        }
        cout << endl;
    }
    return 0;
}