isPrev :: (Int,Int,Int)->(Int,Int,Int)->Bool
isPrev (y1,m1,d1) (y2,m2,d2)
    | y1<y2                     = True
    | y1==y2 && m1<m2           = True
    | y1==y2 && m1==m2 && d1<d2 = True
    | otherwise                 = False

era :: (Int,Int,Int)->String
era (y,m,d) 
    | isPrev (y,m,d) (1868, 9, 8) = "pre-meiji"
    | isPrev (y,m,d) (1912, 7,30) = "meiji " ++(show (y-1868+1))++" "++(show m)++" "++(show d)
    | isPrev (y,m,d) (1926,12,25) = "taisho "++(show (y-1912+1))++" "++(show m)++" "++(show d)
    | isPrev (y,m,d) (1989, 1, 8) = "showa " ++(show (y-1926+1))++" "++(show m)++" "++(show d)
    | otherwise                   = "heisei "++(show (y-1989+1))++" "++(show m)++" "++(show d)

solve str = do
    let y = read ((words str)!!0) :: Int
    let m = read ((words str)!!1) :: Int
    let d = read ((words str)!!2) :: Int
    putStrLn (era (y,m,d))

main = do
    str <- getContents
    mapM_ solve $ lines str