//#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
//#include<algorithm>
//#include<cmath>
//#include<string>
//#include<cctype>
//#include <vector>
using namespace std;
int main() {
	int y, m, d;
	while (cin >> y >> m >> d) {
		int s = y * 416 + m * 32 + d;
		if (s < 777384) cout << "pre-meiji" << endl;
		else if (s < 795646) cout << "meiji " << y - 1867 << " " << m << " " << d << endl;
		else if (s < 801625) cout << "taisho " << y - 1911 << " " << m << " " << d << endl;
		else if (s < 827464) cout << "showa " << y - 1925 << " " << m << " " << d << endl;
		else cout << "heisei " << y - 1988 << " " << m << " " << d << endl;
	}
	return 0;
}