import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
//import std.regex;
import std.container;

void main()
{
	foreach (line; stdin.byLine) {
		auto date = line.split.map!(to!int);

		if (date[0] > 1989 || (date[0] == 1989 && (date[1] > 1 || (date[1] == 1 && date[2] >= 8)))) write("heisei ", date[0]-1988," ");
		else if (date[0] > 1926 || (date[0] == 1926 && (date[1] > 12 || (date[1] == 12 && date[2] >= 25)))) write("showa ", date[0]-1925," ");
		else if (date[0] > 1912 || (date[0] == 1912 && (date[1] > 7 || (date[1] == 7 && date[2] >= 30)))) write("taisho ", date[0]-1911," ");
		else if (date[0] > 1868 || (date[0] == 1868 && (date[1] > 9 || (date[1] == 9 && date[2] >= 8)))) write("meiji ", date[0]-1867," ");
		else {
			writeln("pre-meiji");
			continue;
		}
		writeln(date[1], " ", date[2]);
	}
}