#include<bits/stdc++.h>
using namespace std;
#define rep(i,a) for(int i = 0; i < (a); i++)
#define reps(i, a, b) for(int i = (a); i < (b); i++)
#define INF 1e9
typedef vector<int> vi;
typedef vector<vi> vii;
typedef pair<int, int> pii;
int main() {
	int year,month,day;
	vector<pair<string, int>> status = {make_pair("heisei",1989),make_pair("showa",1926),make_pair("taisho",1912),make_pair("meiji", 1868)};
	while(cin >> year >> month >> day) {
		string str;
		int st = 0;
		if(year > 1989 || (year == 1989 && month > 1) || (year == 1989 && month == 1 && day >= 8)) st = 0;
		else if(year > 1926 || (year == 1926 && month == 12 && day >= 25)) st = 1;
		else if(year > 1912 || (year == 1912 && month > 7) || (year == 1912 && month == 7 && day >= 30)) st = 2;
		else if(year > 1868 || (year == 1868 && month > 9) || (year == 1868 && month == 9 && day >= 8)) st = 3;
		else str = "pre-meiji";
		if(str == "pre-meiji") cout << str << endl;
		else printf("%s %d %d %d\n", status[st].first.c_str(), year - status[st].second + 1, month, day);
	}
	return 0;
}