#include <bits/stdc++.h>
using namespace std;

//  a < b ?
bool izryt(int h, int m, int d, int H, int M, int D) {
  if (h < H) return true;
  if (h > H) return false;

  if (m < M) return true;
  if (m > M) return false;

  return d < D;
}

void diff(int H, int h, int m, int d) {
  cout << h - H + 1 << " " << m << " " << d << endl;
}

void solve(int h, int m, int d) {
  if (izryt(h, m, d, 1868, 9, 8)) {
    cout << "pre-meiji" << endl;
  }

  else if (izryt(h, m, d, 1912, 7, 30)) {
    cout << "meiji ";
    diff(1868, h, m, d);
  }

  else if (izryt(h, m, d, 1926, 12, 25)) {
    cout << "taisho ";
    diff(1912, h, m, d);
  }

  else if (izryt(h, m, d, 1989, 1, 8)) {
    cout << "showa ";
    diff(1926, h, m, d);
  }

  else {
    cout << "heisei ";
    diff(1989, h, m, d);
  }
}

int main() {
  int h, m, d;
  while (cin >> h >> m >> d) {
    solve(h, m, d);
  }
}