def main(input = STDIN)
  while (ymd = input.gets)
    y, m, d = ymd.split(" ").map(&:to_i)
    ymd = y * 10000 + m * 100 + d
    if ymd < 18680908
      puts "pre-meiji"
    elsif ymd < 19120730
      puts "meiji #{y - 1867} #{m} #{d}"
    elsif ymd < 19261225
      pust "taisho #{y - 1911} #{m} #{d}"
    elsif ymd < 19890108
      puts "showa #{y - 1925} #{m} #{d}"
    else
      puts "heisei #{y - 1988} #{m} #{d}"
    end
  end
end
main