#include <iostream>
#include <string>
using namespace std;

bool check( string name, int yy, int mm, int dd, int y, int m, int d )
{
	if ( y <= yy-1 )
	{
		cout << name;
		return true;
	}
	if ( y == yy )
	{
		if ( m <= mm-1 )
		{
			cout << name;
			return true;
		}
		else if ( m == mm )
		{
			if ( d <= dd )
			{
				cout << name;
				return true;
			}
		}
	}
	return false;
}

int main( void )
{
	int y, m, d;
	while ( cin >> y >> m >> d )
	{
		if ( check( "pre-meiji", 1868, 9, 7, y, m, d ) )
		{
			cout << endl;
			continue;
		}
		else if ( check( "meiji", 1912, 7, 29, y, m, d ) )
		{
			cout << " " << y - 1868 + 1 << " " << m << " " << d << endl;
			continue;
		}
		else if ( check( "taisho", 1926, 12, 24, y, m, d ) )
		{
			cout << " " << y - 1912 + 1 << " " << m << " " << d << endl;
		}
		else if ( check( "showa", 1989, 1, 7, y, m, d ) )
		{
			cout << " " << y - 1926 + 1 << " " << m << " " << d << endl;
			continue;
		}
		else
		{
			cout << " " << "heisei " << y - 1989 + 1 << " " << m << " " << d << endl;
		}
	}
	return 0;
}