#include<iostream>
using namespace std;

int main()
{
    int meiji = 1867, taisho = 1911, showa = 1925, heisei = 1988;

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