while gets
  y,m,d=$_.split.map(&:to_i)
  num=(y.to_s+format("%02d",m)+format("%02d",d)).to_i
  if num < 18680908 then puts "pre-meiji"
  else
    case
    when num < 19120730 then era = "meiji "+(y-1867).to_s
    when num < 19261225 then era = "taisho "+(y-1911).to_s
    when num < 19890108 then era = "showa "+(y-1925).to_s
    else era = "heisei "+(y-1988).to_s
    end
    puts "#{era} #{m} #{d}"
  end
end