#include <iostream>
#include <cstdio>
using namespace std;
string G[] = {"meiji",
	      "taisho",
	      "showa",
	      "heisei"};

int Gnum[] = {1868,1912,1926,1989};
int YEAR(int year){
  if(19890108 <= year){
    return 3;
  }else if(19891225 <= year ){
    return 2;
  }else if( 19120729 <= year ){
    return 1;
  } else if( 18680908 <= year   ){
    return 0;
  }
  return 4;
}
int main(){
  long long int tosi,mon,day;
  while( cin >> tosi >> mon >> day ){
    int gen = YEAR(tosi*10000 + mon*100 + day);
    if(gen == 4)cout << "pre-meiji" << endl;
    else cout <<  G[gen] << ' ' << tosi - Gnum[gen]+1 <<' '<< mon <<' '<< day << endl; 

      }
}