#include <iostream>
using namespace std;

unsigned getSerial( int y, int m, int d ){
	if ( y < 0 || y > 2000 ) return 0;
	int month[ 12 ] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
	unsigned serial = 0;
	serial += ( y - 1 ) * 365 + ( y - 1 ) / 4;
	if ( !( y % 4 ) ) month[ 1 ] = 29;
	for ( int i = 0; i < m - 1; ++i ){
		serial += month[ i ];
	}
	serial += d;
	return serial;
}

int main(){
	int y, m, d;
	unsigned serial;

	while ( cin >> y >> m >> d ){
		if ( y < 1868 ){
			cout << "pre-meiji" << endl;
			continue;
		}else if ( y > 1989 ){
			cout << "heisei " << y - 1988 << " " << m << " " << d << endl;
			continue;
		}
		serial = getSerial( y, m, d );

		if ( serial < getSerial( 1868, 9, 8 ) ){
			cout << "pre-meiji" << endl;
		}else if (  serial >= getSerial( 1989, 1, 8 ) ){
			cout << "heisei " << y - 1988 << " " << m << " " << d << endl;
		}else if ( serial < getSerial( 1912, 7, 30 ) ){
			cout << "meiji " << y - 1867 << " " << m << " " << d << endl;
		}else if ( serial < getSerial( 1926, 12,25 ) ){
			cout << "taisho " << y - 1911 << " " << m << " " << d << endl;
		}else{
			cout << "showa " << y - 1925 << " " << m << " " << d << endl;
		}
	}
	return 0;
}