#include<iostream>
#include<cstdio>

using namespace std;

int main()
{
  int y, m, d, a;
  while(  cin >> y >> m >> d ) {

    a = y*10000 + m*100 + d;
    if(a >= 18680908) {
      if(a >= 19120730) {
	if(a >= 19261225) {
	  if(a >= 19890108) cout << "heisei" << ' ' << y - 1989 + 1;
	  else cout << "showa" << ' ' << y - 1926 + 1;
	}
	else cout << "taisho" << ' ' << y - 1912 + 1;
      }
      else cout << "meiji" << ' ' << y - 1868 + 1;
      cout << ' ' << m << ' ' << d << endl;
    }
    else cout << "pre-meiji" << endl;
  }
}