#include<bits/stdc++.h>
using namespace std;

int main(){
  int year[] = {1868,1912,1926,1989};
  int month[] = {9,7,12,1};
  int day[] = {8,30,25,8};
  string gen[] = {"pre-meiji","meiji","taisho","showa","heisei"};
  int y,m,d;
  while(cin >> y >> m >> d){
    bool flg = true;
    for(int i=3;i>=0;i--){
      if(y > year[i]){
	cout << gen[i+1] << " ";
	cout << y - year[i] + 1 << " " << m << " " << d << endl;
	flg = false;
	break;
      }
      else if(y == year[i] && m >= month[i]){
	if(m > month[i]){
	  cout << gen[i+1] << " ";
	  cout << y - year[i] + 1 << " " << m << " " << d << endl;
	  flg = false;
	  break;
	}
	else if(m == month[i] && d >= day[i]){
	  cout << gen[i+1] << " ";
	  cout << y - year[i] + 1 << " " << m << " " << d << endl;
	  flg = false;
	  break;
	}
      }
    }
    if(flg) cout << gen[0] << endl;
  }
}
  
	