#include<iostream>
#include<cstdio>
#include<string>
using namespace std;
int main() {
	int y, m, d;
	while (cin >> y >> m >> d) {
		string mode;
		if (y < 1868)mode = "pre-meiji";
		else if (y == 1868) {
			int k = m * 100 + d;
			if (k < 908)mode = "pre-meiji";
			else mode = "meiji";
		}
		else if (y > 1868 && y < 1912)mode = "meiji";
		else if (y == 1912) {
			int k = m * 100 + d;
			if (k < 730)mode = "meiji";
			else mode = "taisho";
		}
		else if (y > 1912 && y < 1926)mode = "taisho";
		else if (y == 1926) {
			int k = m * 100 + d;
			if (k < 1225)mode = "taisho";
			else mode = "showa";
		}
		else if (y > 1926 && y < 1989)mode = "showa";
		else if (y == 1989) {
			int k = m * 100 + d;
			if (k < 108)mode = "showa";
			else mode = "heisei";
		}
		else mode = "heisei";
		if (mode == "pre-meiji")cout << mode << endl;
		else {
			cout << mode << ' ';
			if (mode == "meiji")cout << y - 1867;
			else if (mode == "taisho")cout << y - 1911;
			else if (mode == "showa")cout << y - 1925;
			else cout << y - 1988;
			printf(" %d %d\n", m, d);
		}
	}
}