import std.stdio;
import std.algorithm;
import std.string;
import std.functional;
import std.array;
import std.conv;
import std.math;

void main(){

    while(true){
	auto i = readln();
	if(stdin.eof()) break;
	auto s = split(i).to!(int[]);
	int y = s[0];
	int m = s[1];
	int d = s[2];
	string era = "pre-meiji";
	int yy = 0;
	if(1869<=y||(1868==y&&(9<m||(9==m&&8<=d)))){
	    era = "meiji";
	    yy = y - 1867;
	}
	if(1913<=y||(1912<=y&&(7<m||(7==m&&30<=d)))){
	    era = "taisho";
	    yy = y - 1911;
	}
	if(1927<=y||(1926<=y&&(12<m||(12==m&&25<=d)))){
	    era = "showa";
	    yy = y - 1925;
	}
	if(1990<=y||(1989==y&&(1<m||(1==m&&8<=d)))){
	    era = "heisei";
	    yy = y - 1988;
	}
	if(era=="pre-meiji") writeln(era);
	else writef("%s %d %d %d\n",era,yy,m,d);
    }
}