#include <iostream>
#include <stdio.h>
#include <math.h>
#include <iomanip>

using namespace std;
int nen,tsuki,hi;


int main(void)
{
    while(cin>>nen>>tsuki>>hi){
        int num = nen*10000+tsuki*100+hi;
        
        if(num>=19890108){
            cout<<"heisei "<<nen-1989+1<<" "<<tsuki<<" "<<hi<<endl;
        }else if(num>=19261225){
            cout<<"showa "<<nen-1926+1<<" "<<tsuki<<" "<<hi<<endl;
        }else if(num>=19120730){
            cout<<"taisho "<<nen-1912+1<<" "<<tsuki<<" "<<hi<<endl;
        }else if(num>=18680908){
            cout<<"meiji "<<nen-1868+1<<" "<<tsuki<<" "<<hi<<endl;
        }else{
            cout<<"pre-meiji"<<endl;
        }
        
        
    }
    
}