#include <iostream>
using namespace std;

int main() {
  int year,month,day,z;
  while(cin >> year >> month >> day) {
    z = year * 10000 + month * 100 + day;
    if(z < 18680908)
      cout << "pre-meiji" << endl;
    else if(z <= 19120729)
      cout << "meiji" << " " <<year % 1867 << " " << month << " " << day << endl;
    else if(z <= 19261224)
      cout << "taisho" << " " <<year % 1911 << " " << month << " " << day << endl;
    else if(z <= 19890107)
      cout << "showa" << " " << year % 1925 << " " << month << " " << day << endl;
    else
      cout << "heisei" << " " << year % 1988 << " " << month << " " << day << endl;
  }
}