
require 'date'
require 'pp'

era = [[1868, 9, 8], [1912, 7, 30], [1926, 12, 25], [1989, 1, 8]].map {
  |d| Date.new(d[0], d[1], d[2])
}
names = ["pre-meiji", "meiji", "taisho", "showa", "heisei"]

while ((line = $stdin.gets) != nil) do
  date = line.chomp.split(" ").map(&:to_i)
  d = Date.new(date[0], date[1], date[2]);
  ans = 0
  dates = (era + [d]).sort
  dates.each_with_index do |x, i|
    ans = i if (x == d)
  end
  if (ans == 0) then puts "#{names[ans]}"
  else
    puts "#{names[ans]} #{d.year - dates[ans - 1].year + 1} #{d.month} #{d.day}"
  end
end