while line = gets
y,m,d = line.split.map(&:to_i)
ymd = sprintf("%04d%02d%02d",y,m,d).to_i
if ymd < 18680908
  puts "pre-meiji"
  elsif 18680908 <= ymd && ymd <= 19120729 
  puts "meiji #{y - 1867} #{m} #{d}"
  elsif 19120730 <= ymd && ymd <=19261224
  puts "taisho #{y - 1911} #{m} #{d}"
  elsif 19261225 <= ymd && ymd <= 19890107
  puts "showa #{y - 1925} #{m} #{d}"
else
  puts "heisei #{y - 1988} #{m} #{d}"
end
end
