import std.stdio, std.string, std.conv;
import std.array, std.algorithm, std.range;

string cnv(int[] ymd)
{
    immutable y=ymd[0], m=ymd[1], d=ymd[2];
    immutable S = ["meiji","taisho","showa","heisei"];
    foreach_reverse(i,t;[[1868,9,8],[1912,7,30],[1926,12,25],[1989,1,8]])
    {
        if(y>t[0] || (y==t[0] && (m>t[1] || (m==t[1] && d>=t[2]))))
            return S[i]~" "~[y-t[0]+1,m,d].map!(to!string).join(" ");
    }
    return "pre-meiji";
}

void main()
{
    stdin.byLine().map!(s=>cnv(s.split().map!(to!int).array())).join("\n").writeln();
}