#include <cstdio>
#include <utility>
using namespace std;

typedef pair<int, int> MD;
typedef pair<int, MD> YMD;

const char *msgs[] = {"meiji", "taisho", "showa", "heisei"};
YMD comp[] = {
  YMD(1868, MD(9, 8)),
  YMD(1912, MD(7, 30)),
  YMD(1926, MD(12, 25)),
  YMD(1989, MD(1, 8)),
};

int main() {
  while (1) {
    int y, m, d;
    if (scanf("%d%d%d", &y, &m, &d) != 3) return 0;

    YMD p = YMD(y, MD(m, d));
    bool found = false;
    for (int i=3; i>=0; i--) {
      if (p >= comp[i]) {
        printf("%s %d %d %d\n", msgs[i], y-comp[i].first+1, m, d);
        found = true;
        break;
      }
    }

    if (!found) puts("pre-meiji");
  }
}