#include <iostream>
using namespace std;

class Date{
public:
  int y, m, d;

  Date(){}
  Date(int _y, int _m, int _d){
    y = _y;
    m = _m;
    d = _d;
  }

  bool operator<=(const Date &date)const{
    if(y == date.y){
      if(m == date.m){
        return d <= date.d;
      }
      return m < date.m;
    }
    return y < date.y;
  }
};

int main(){
  Date date;
  Date from[] = {Date(1868, 9, 8), Date(1912, 7, 30), Date(1926, 12, 25), Date(1989, 1, 8)};
  string name[] = {"meiji", "taisho", "showa", "heisei"};

  while(cin >> date.y >> date.m >> date.d){
    int gengo = -1;

    for(int i = 3; i >= 0; i--){
      if(from[i] <= date){
        gengo = i;
        break;
      }
    }

    if(gengo == -1){
      cout << "pre-meiji" << endl;
    }
    else{
      cout << name[gengo] << " " << date.y - from[gengo].y + 1 << " " << date.m << " " << date.d << endl;
    }
  }
}