#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <cmath>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>

using namespace std;

typedef long long ll;

#define ITER( c ) __typeof( c ).begin()
#define REP( i, m, n ) for ( int i = m; i < n; i++ )
#define UREP( i, m, n ) for ( unsigned int i = m; i < n; i++ )
#define IREP( c, it ) for ( ITER(c) it = c.begin(); it != c.end(); ++it )
#define ALL( c ) c.begin(), c.end()
#define PB( n ) push_back( n );
#define MP( a, b ) make_pair( a, b )
#define fst first
#define snd second

int dtod( int y, int m, int d )
{
	return ( y * 365 ) + ( m * 30 ) + d;
}

int dtoy( int days )
{
	return days / 365;
}

int main()
{
	const int PRE = dtod( 1868, 9, 7 );
	const int MEIJI = dtod( 1912, 7, 29 );
	const int TAISHO = dtod( 1926, 12, 24 );
	const int SHOWA = dtod( 1989, 1, 7 );

	int y, m, d;

	while ( cin >> y >> m >> d )
	{
		int days = dtod( y, m, d );

		if ( days <= PRE )
		{
			cout << "pre-meiji" << endl;
			break;
		}
		else if ( days <= MEIJI )
		{
			cout << "meiji " << y % 1868 + 1;
		}
		else if ( days <= TAISHO )
		{
			cout << "taisho " << y % 1912 + 1;
		}
		else if ( days <= SHOWA )
		{
			cout << "showa " << y % 1926 + 1;
		}
		else
		{
			cout << "heisei " << y % 1989 + 1;
		}

		cout << ' ' << m << ' ' << d << endl;
	}

	return 0;
}