#include<iostream>
using namespace std;
int main() {
	int y, m, d;
	while (cin >> y >> m >> d) {
		int g = -1;
		if (y >= 1869 && y <= 1911)
			g = 0;
		else if (y >= 1913 && y <= 1925)
			g = 1;
		else if (y >= 1927 && y <= 1988)
			g = 2;
		else if (y >= 1990)
			g = 3;
		else if (y == 1912) {
			if (m >= 8)
				g = 1;
			else if (m <= 6)
				g = 0;
			else {
				if (d <= 29)
					g = 0;
				else
					g = 1;
			}
		}
		else if (y == 1926) {
			if (m <= 11)
				g = 1;
			else {
				if (d <= 24)
					g = 1;
				else
					g = 2;
			}
		}
		else if (y == 1989) {
			if (m >= 2)
				g = 3;
			else {
				if (d <= 7)
				g = 2;
				else
					g = 3;
			}
		}
		else if (y == 1868) {
			if (m >= 10)
				g = 0;
			else if(m==9){
				if (d >= 8)
					g = 0;
			}
		}
		if (g == 0)
			cout << "meiji " << (y - 1868) + 1 << " " << m << " " << d << endl;
		else if (g == 1)
			cout << "taisho " << ((y - 1912) + 1) << " " << m << " " << d << endl;
		else if (g == 2)
			cout << "showa " << (y - 1926) + 1 << " " << m << " " << d << endl;
		else if (g == 3)
			cout << "heisei " << (y - 1989) + 1 << " " << m << " " << d << endl;
		else if (g == -1)
			cout << "pre-meiji" << endl;
	}
}