#include <iostream>
#include <cstdio>
using namespace std;
int main(void) {
  int y, m, d;
  int day;
  while(scanf("%d %d %d", &y, &m, &d) != EOF) {
    day = y * 365 + m * 30 + d;
    if(day >= 682098 && day <= 698119) {
      cout << "meiji" << ' ' << y - 1868 + 1<< ' ' << m << ' ' << d << endl;
    }
    else if(day >= 698120 && day <= 703374) {
      cout << "taisho" << ' ' << y - 1912 + 1<< ' ' << m << ' ' << d << endl;
    }
    else if(day >= 703375 && day <= 726022) {
      cout << "showa" << ' ' << y - 1926 + 1<< ' ' << m << ' ' << d << endl;
    }
    else if(day >= 726023) {
      cout << "heisei" << ' ' << y - 1989 + 1 << ' ' << m << ' ' << d << endl;
    }
    else if(day <= 682097) {
      cout << "pre-meiji" << endl;
    }
  }
  return 0;
}