#include<iostream>
#include<string>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
using namespace std;

int main() {

    int y, m, d;
    while(cin >> y >> m >> d) {
        if( y > 1989 ) {
            cout << "heisei " << y - 1988 << " " << m << " " << d;
        } else if ( y == 1989 ) {
            if ( m > 1 || ( m == 1 && d >= 8) ) {
                cout << "heisei 1 " << m << " " << d;
            } else {
                cout << "showa 64 " << m << " " << d;
            }
        } else if ( y > 1926 ) {
            cout << "showa " << y - 1925 << " " << m << " " << d;
        } else if ( y == 1926) {
            if ( m == 12 && d >= 25 ) {
                cout << "showa 1 "<< m << " " << d;
            } else {
                cout << "taisho 15 "<< m << " " << d;
            }
        } else if ( y > 1912 ) {
            cout << "taisho " << y - 1911 << " "<< m << " " << d;
        } else if ( y == 1912 ) {
            if ( m >= 8 || ( m == 7 && d >= 30) ) {
                cout << "taisho 1 "<< m << " " << d;
            } else {
                cout << "meiji 45 "<< m << " " << d;
            }
        } else if ( y > 1868 ) {
            cout << "meiji " << y - 1867 << " " << m << " " << d;
        } else if ( y == 1868 ) {
            if( m >= 10 || ( m == 9 & d >= 8 ) ) {
                cout << "meiji 1 " << m << " " << d;
            } else {
                cout << "pre-meiji";
            }
        } else {
            cout << "pre-meiji";
        }
        cout << endl;
    }
    
    return 0;
}