#include <iostream>
#include <string>
using namespace std;

int main() {

  int y, m, d;
  int yd[5] = { 1868, 1912, 1926, 1989, 99999 };
  int md[5] = {    9,    7,   12,    1,     0 };
  int dd[5] = {    8,   30,   25,    8,     0 };
  string n[4] = { "meiji", "taisho", "showa", "heisei" };

  while( cin >> y >> m >> d ) {

    for ( int i = 0; i < 5; i++ ) {

      if ( y < yd[i] || ( y == yd[i] && ( m < md[i] || ( m == md[i] && d < dd[i] ) ) ) ) {
	if ( i == 0 ) {
	  cout << "pre-meiji" << endl;
	  break;
	}else {
	  cout << n[i-1] << " " << y - yd[i-1] + 1 << " " << m << " " << d << endl;
	  break;
	}
      }

    }

  }

  return 0;

}