 #include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 #include<queue>
 #include<deque>
 #include<functional>
 #include<utility>
 #include<list>
 
 using namespace std;
 
 int main()
 {
   int year,month,day;
   while(cin>>year>>month>>day)
   {
     if(year<1868||(year==1868&&month<9)||(year==1868&&month==9&&day<8))
     {
       cout<<"pre-meiji"<<endl;                                                                   
     }                         
     else if(year<1912||(year==1912&&month<7)||(year==1912&&month==7&&day<30))
     {
       cout<<"meiji "<<(year-1868+1)<<" "<<month<<" "<<day<<endl;     
     }   
     else if(year<1926||(year==1926&&month<12)||(year==1926&&month==12&&day<25))
     {
        cout<<"taisho "<<(year-1912+1)<<" "<<month<<" "<<day<<endl;        
     }
     else if(year<1989|(year==1989&&month<1)||(year==1989&&month==1&&day<8))
     {
        cout<<"showa "<<(year-1926+1)<<" "<<month<<" "<<day<<endl;       
     }
     else
     {
       cout<<"heisei "<<(year-1989+1)<<" "<<month<<" "<<day<<endl;   
     }
   } 
   //while(1);
   return 0; 
 }