while gets
  y,m,d = $_.split.map(&:to_i)
  case y
  when 0..1867
    puts "pre-meiji"
  when 1868..1911
    if y!=1868||m>9||d>7
      puts ["meiji",y-1868+1,m,d].join(" ")
    else
      puts "pre-meiji"
    end
  when (1912..1925)
    if y!=1912||m>7||d>29
      puts ["taisho",y-1912+1,m,d].join(" ")
    else
      puts ["meiji",y-1868+1,m,d].join(" ")
    end
  when(1926..1989)
    if y!=1926||d>24
      if y==1989&&d>7
        puts ["heisei",y-1989+1,m,d].join(" ")
      else
        puts ["showa",y-1926+1,m,d].join(" ")
      end
    else
      puts ["taisho",y-1912+1,m,d].join(" ")
    end
  else  puts ["heisei",y-1989+1,m,d].join(" ")
  end
end
#元号  期間
#meiji 1868. 9. 8 〜 1912. 7.29
#taisho  1912. 7.30 〜 1926.12.24
#showa 1926.12.25 〜 1989. 1. 7
#heisei  1989. 1. 8 〜