x = gets 
until x.nil?
 y = x.split(" ")
 year = y[0].to_i
 month = y[1].to_i
 day = y[2].to_i
 koyomi = 0
 if year < 1868
  puts "pre-meiji"
 end
 
 if year > 1989
  koyomi = year - 1988
  puts "heisei #{koyomi} #{month} #{day}"
 end

 if year == 1868
  if month < 9
   puts "pre-meiji"
  elsif month == 9
    if day <= 7
     puts "pre-meiji"
    else
     koyomi = 1
     puts "meiji #{koyomi} #{month} #{day}"
    end
  else
    koyomi = 1
    puts "meiji #{koyomi} #{month} #{day}"
  end
 end
 
 if year > 1868 && year < 1912
  koyomi = year - 1867
  puts "meiji #{koyomi} #{month} #{day}"
 end

 if year == 1912
  if month < 7
   koyomi = year - 1867
   puts "meiji #{koyomi} #{month} #{day}"
  elsif month == 7
    if day <= 29
     koyomi = year - 1867
     puts "meiji #{koyomi} #{month} #{day}"
    else
     koyomi = 1
     puts "taisho #{koyomi} #{month} #{day}"
    end
  else
    koyomi = 1
    puts "taisho #{koyomi} #{month} #{day}"
  end
 end

 if year > 1912 && year < 1926
  koyomi = year - 1911
  puts "taisho #{koyomi} #{month} #{day}"

 end
 
 if year == 1926
  if month < 12
   koyomi = year - 1911
   puts "taisho #{koyomi} #{month} #{day}"
  elsif month == 12
    if day <= 24
     koyomi = year -1911
     puts "taisho #{koyomi} #{month} #{day}"
    else
     koyomi = 1
     puts "showa #{koyomi} #{month} #{day}"
    end
  else
    koyomi = 1
    puts "showa #{koyomi} #{month} #{day}"
  end
 end

 if year > 1926 && year < 1989
  koyomi = year - 1925
  puts "showa #{koyomi} #{month} #{day}"
 end

 if year == 1989
  if month < 1
   koyomi = year - 1925
   puts "showa #{koyomi} #{month} #{day}"
  elsif month == 1
    if day <= 7
     koyomi = year - 1925
     puts "showa #{koyomi} #{month} #{day}"
    else
     koyomi = 1
     puts "heisei #{koyomi} #{month} #{day}"
    end
  else
    koyomi = 1
    puts "heisei #{koyomi} #{month} #{day}"
  end
 end




 x = gets
end
