#include <iostream>

using namespace std;

void solve()
{
	int year, month, day;
	while(cin >> year >> month >> day)
	{
		if(year < 1868)
		{
			cout << "pre-meiji";
			continue;
		}
		else if(1869 <= year && year < 1912)
		{
			year = year - 1867;
			cout << "meiji ";
		}
		else if(1913 <= year && year < 1926)
		{
			year = year - 1911;
			cout << "taisho ";
		}
		else if(1927 <= year && year < 1989)
		{
			year = year - 1925;
			cout << "showa ";
		}
		else if(1990 <= year)
		{
			year = year - 1988;
			cout << "heisei ";
		}
		else if(year == 1868)
		{
			if(month == 9 && day >= 8 || month >= 10)
			{
				year = year - 1867;
				cout << "meiji ";
			}
			else
			{
				cout << "pre-meiji";
				continue;
			}
		}
		else if(year == 1912)
		{
			if(month <= 6 || month == 7 && day <= 29)
			{
				year = year - 1867;
				cout << "meiji ";
			}
			else
			{
				year = year - 1911;
				cout << "taisho ";
			}
		}
		else if(year == 1926)
		{
			if(month < 12 || month == 12 && day <= 24)
			{
				year = year - 1911;
				cout << "taisho ";
			}
			else
			{
				year = year - 1925;
				cout << "showa ";
			}
		}
		else if(year == 1989)
		{
			if(month == 1 && day <= 7)
			{
				year = year - 1925;
				cout << "showa ";
			}
			else
			{
				year = year - 1988;
				cout << "heisei ";
			}
		}
		cout << year << " " << month << " " << day << endl;
	}
}

int main()
{
	solve();
	return(0);
}