#include<iostream>
using namespace std;
int main(){
    int y,m,d;
    string str[]={
        "pre-meiji",
        "meiji",
        "taisho",
        "showa",
        "heisei"
    };
    while(cin>>y>>m>>d){
        int p=y*10000+m*100+d,c;
        if(p<18680908)c=0;
        else if(p<19120730)c=1;
        else if(p<19261225)c=2;
        else if(p<19890108)c=3;
        else c=4;
        cout<<str[c];
        switch(c){
        case 1:
            cout<<" "<<y-1868+1;
            break;
        case 2:
            cout<<" "<<y-1912+1;
            break;
        case 3:
            cout<<" "<<y-1926+1;
            break;
        case 4:
            cout<<" "<<y-1989+1;
        }
        if(c!=0){
            cout<<" "<<m<<" "<<d;
        }
        cout<<endl;
    }
}