#include <iostream>
using namespace std;

int main(){
    int pre_meiji_e = 18680907;
    int meiji_e = 19120729;
    int meiji_s = 1868;
    int taisho_e = 19261224;
    int taisho_s = 1912;
    int showa_e = 19890107;
    int showa_s = 1926;
    int heisei_s = 1989;

    int y, m, d, n;
    while(cin >> y >> m >> d){
        n = y*10000 + m*100 + d;

        if(n <= pre_meiji_e) cout << "pre-meiji" << endl;
        else if(n <= meiji_e) cout << "meiji " << y-meiji_s+1 << " " << m << " " << d << endl;
        else if(n <= showa_e) cout << "showa " << y-showa_s+1 << " " << m << " " << d << endl;
        else  cout << "heisei " << y-heisei_s+1 << " " << m << " " << d << endl;
    }
}