#include <iostream>
using namespace std;

int y, m, d;

int conv(){
    if( y < 1868 || (y == 1868 && ( m < 9 || (m == 9 && d < 8) ) ) ){
        cout << "pre-meiji" << endl;
        return 1;
    }
    if( y < 1912 || (y == 1912 && ( m < 7 || (m == 7 && d <= 29) ) ) ){
        cout << "meiji ";
        cout << y-1867 << ' ';
    }else if( y < 1926 || (y == 1926 && ( m < 12 || d <= 24 ))){
        cout << "taisho ";
        cout << y-1911 << ' ';
    }else if( y < 1989 || (y == 1989 && ( m == 1 && d <= 7 ) ) ){
        cout << "showa ";
        cout << y-1925 << ' ';
    }else{
        cout << "heisei ";
        cout << y-1988 << ' ';
    }
    return 0;
}

int main(){
    while( cin >> y >> m >> d ){
        if( conv() ) continue;
        cout << m << ' ' << d << endl;
    }
    return 0;
}