#include "bits/stdc++.h"

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back



int main(){
    int y,m,d;
    while(cin>>y>>m>>d){
        if( y<1868 || (y==1868 && ( m<9 || (m==9 && d<8))) ){
            cout<<"pre-meiji"<<endl;
        }else if( y<1912 || (y==1912 && ( m<7  || (m==7  && d<=29))) ){
            cout<<"meiji ";
            cout<<1+y-1868<<" "<<m<<" "<<d<<endl;
        }else if( y<1926 || (y==1926 && ( m<12 || (m==12 && d<=24))) ){
            cout<<"taisho ";
            cout<<1+y-1912<<" "<<m<<" "<<d<<endl;
        }else if( y<1989 || (y==1989 && ( m<1  || (m==1  && d<=7 ))) ){
            cout<<"showa ";
            cout<<1+y-1926<<" "<<m<<" "<<d<<endl;
        }else{
            cout<<"heisei ";
            cout<<1+y-1989<<" "<<m<<" "<<d<<endl;
        }
    }
}