#include<iostream>
using namespace std;
int a, b, c, d;
int main() {
	while (cin >> a >> b >> c) {
		d = a * 10000 + b * 100 + c;
		if (d < 18680908) {
			cout << "pre-meiji" << endl;
		}
		else if (d < 19120730) {
			cout << "meiji " << a - 1867 << ' ' << b << ' ' << c << endl;
		}
		else if (d < 19261225) {
			cout << "taisho " << a - 1911 << ' ' << b << ' ' << c << endl;
		}
		else if (d < 19890108) {
			cout << "showa " << a - 1925 << ' ' << b << ' ' << c << endl;
		}
		else {
			cout << "heisei " << a - 1988 << ' ' << b << ' ' << c << endl;
		}
	}
}