#include <iostream>

using namespace std;

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