#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
/*
元号	期間
meiji	1868. 9. 8	〜	1912. 7.29
taisho	1912. 7.30	〜	1926.12.24
showa	1926.12.25	〜	1989. 1. 7
heisei	1989. 1. 8	〜
*/
bool comp (int y1, int m1, int d1, int y2, int m2, int d2, bool flag )
{
	if (y1 != y2 ) return y1 < y2;
	if (m1 != m2 ) return m1 < m2;
	return (flag ? d1 <= d2 : d1 < d2 );
}


int main()
{
//	cut here before submit 
//	freopen ("testcase.era_name_transformation2", "r", stdin );
	const int y[] = {INT_MIN, 1868, 1912, 1926, 1989, INT_MAX };
	const int m[] = {INT_MIN,    9,    7,   12,    1, INT_MAX }; 
	const int d[] = {INT_MIN,    8,   30,   25,    8, INT_MAX };
	const string gengo[] = { "pre-meiji", "meiji", "taisho", "showa", "heisei" };
	int n = sizeof (y)/sizeof (y[0] );

	int year, month, day;
	while (scanf ("%d %d %d", &year, &month, &day ) != EOF ){
		rep (i, n - 1 ){
			if (comp (y[i], m[i], d[i], year, month, day, true ) 
			 && comp (year, month, day, y[i+1], m[i+1], d[i+1], false ) ){
				if (i ==  0 ){
					cout << gengo[i] << endl;
				}else{
					cout << gengo[i] << ' ' << (year - y[i] + 1) << ' ' << month << ' ' << day << endl;
				} // end if
				break;
			} // end if
		} // end rep
	} // end loop
		
	return 0;
}