import scala.io.Source.stdin
import scala.collection.mutable.ArrayBuffer

object Main extends App {
  def to(a:Array[Int],y:Int,m:Int,d:Int) =
    (a(0)<y) || (a(0)==y && a(1)<m) || (a(0)==y && a(1)==m && a(2)<=d)

  val b = new ArrayBuffer[String]

  stdin.getLines.foreach { s=>
    val n = s.split(" ").map(_.toInt)
    if(to(n,1868,9,7)) b+="pre-meiji"
    else if(to(n,1912,7,29)) b+="meiji " + (n(0)-1867) + " " + n(1) + " " + n(2)
    else if(to(n,1926,12,24)) b+="taisho " + (n(0)-1911) + " " + n(1) + " " + n(2)
    else if(to(n,1989,1,7)) b+="showa " + (n(0)-1925) + " " + n(1) + " " + n(2)
    else b+="heisei " + (n(0)-1988) + " " + n(1) + " " + n(2)
  }
  println(b.mkString("\n"))
}