#include <iostream>
using namespace std;

int main() {
  int y, m, d;
  int meiji = 1868*365 + 9*31 + 8;
  int taisho = 1912*365 + 7*31 + 30;
  int showa = 1926*365 + 12*31 + 25;
  int heisei = 1989*365 + 1*31+ 8;

  while(cin >> y >> m >> d) {
    int sum = y*365 + m*31 + d;
    
    if(sum < meiji) {
      cout << "pre-meiji" << endl;
    }
    else if(sum < taisho) {
      cout << "meiji " << y-1867 << ' ' << m << ' ' << d << endl;
    }
    else if(sum < showa) {
      cout << "taisho " << y-1911 << ' ' << m << ' ' << d << endl;
    }
    else if(sum < heisei) {
      cout << "showa " << y-1925 << ' ' << m << ' ' << d << endl;
    }
    else {
      cout << "heisei " << y-1988 << ' ' << m << ' ' << d << endl;
    }
  }
}