import std.stdio,std.string,std.conv;

int main()
{
	string s;
	while((s = readln.chomp).length != 0)
	{
		auto _s = s.split(" ");
		int a = _s[0].to!int;
		int b = _s[1].to!int;
		int c = _s[2].to!int;

		int n = a * 10000 + b * 100 + c;
		if(n < 18680908)
		{
			writeln("pre-meiji");
		}
		else if(18680908 <= n && n < 19120730)
		{
			writeln("meiji ",a - 1867," ",b," ",c);
		}
		else if(19120730 <= n && n < 19261225)
		{
			writeln("taisho ",a - 1911," ",b," ",c);
		}
		else if(19261225 <= n && n < 19890108)
		{
			writeln("showa ",a - 1925," ",b," ",c);
		}
		else if(19890108 <= n)
		{
			writeln("heisei ",a - 1988," ",b," ",c);
		}
	}
	return 0;
}