#include <iostream>
using namespace std;

int main(){
    int y,m,d,sum;
    while(cin >> y >> m >> d){
        sum = y*10000 + m*100 + d;
        if(sum < 18680908) cout << "pre-meiji" << endl;
        else if(sum <= 19120729) cout << "meiji" << " " << y-1867 << " " << m << " " << d << endl;
        else if(sum <= 19261224) cout << "taisho" << " " << y-1911 << " " << m << " " << d << endl;
        else if(sum <= 19890107) cout << "showa" << " " << y-1925 << " " << m << " " << d << endl;
        else cout << "heisei" << " " << y-1988 << " " << m << " " << d << endl;
    }
}