#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;

bool comp_year (vector <int> a, vector <int> b, bool flag)
{
	int size = a.size();
	int i;

	for (i = 0; i < size; ++i){
		if (a[i] != b[i] ){
			return a[i] < b[i];
		} // end if
	} // end for

	if (flag ){
		return true;
	} // end if

	return false;
}
	
int main()
{
	const int ad[][3] = { {INT_MIN, INT_MIN, INT_MIN },
				{ 1868,  9, 8  },
				{ 1912,  7, 30 },
				{ 1926, 12, 25 },
				{ 1989,  1,  8 },
				{INT_MAX, INT_MAX, INT_MAX }
			};

	const string gengo[] = {
					"pre-meiji",
					"meiji",
					"taisho",
					"showa",
					"heisei"
			};

	int size = sizeof(ad)/sizeof(ad[0]);
	int len  = sizeof(ad[0])/sizeof(ad[0][0]);
	vector < vector <int> > years (size, vector <int> (len, 0 ) ); 
	string str = "";
	int i,j;
	
	for (i = 0; i < size; ++i){
		for (j = 0; j < len; ++j){
			years[i][j] = ad[i][j];
		} // end for
	} // end for

	while (getline (cin, str ) ){

		vector<int> curr (len, 0 );	// year, month, day order
		stringstream ss(str);

		for (i = 0; i < len; ++i){
			ss >> curr[i];
		} // end for
		
		int match = -1;

		for (i = 0; i < size - 1; ++i ){
			if (comp_year (years[i], curr, true) && comp_year (curr, years[i+1], false ) ){
				match = i;
				break;
			} // end if
		} // end for

		if (match == 0){
			cout << gengo[0] << endl;
		}else{
			int g = curr[0] - years[match][0] + 1;
			cout << gengo[match] << ' ' << g << ' ' << curr[1] << ' ' << curr[2] << endl;
		} // end if

	} // end loop

	return 0;
}