#include <iostream>
using namespace std;
int main() {
	int x,y,z;
	int i= 0;
	while(cin >> x >> y >> z) {
		int a = 100*y+z;
		if(x < 1868) {cout << "pre-meiji "<< endl; } 
		else if(x == 1868) {
			if(a<908) {
				cout << "pre-meiji "<< endl;
			} else{
				cout << "meiji " << 1 << " " << y << " " << z << endl;
			}
		}

		else if(x < 1912) {cout << "meiji " << x-1868+1 << " " << y << " " << z << endl; } 
		else if(x == 1912) {
			if(a<730) {
				cout << "meiji " << x-1868+1 << " " << y << " " << z << endl;
			} else{
				cout << "taisho " << 1 << " " << y << " " << z << endl;
			}
		}

		else if(x < 1926) cout << "taisho " << x-1912+1 << " " << y << " " << z << endl;  
		else if(x == 1926) {
			if(a<1225) {
				cout << "taisho " << x-1912+1 << " " << y << " " << z << endl;
			} else{
				cout << "showa " << 1 << " " << y << " " << z << endl;
			}
		}

		else if(x < 1989) cout << "showa " << x-1926+1 << " " << y << " " << z << endl;  
		else if(x == 1989) {
			if(a<108) {
				cout << "showa " << x-1926+1 << " " << y << " " << z << endl;
			} else{
				cout << "heisei " << 1 << " " << y << " " << z << endl;
			}
		}
		else {
			cout << "heisei " << x-1989+1 << " " << y << " " << z << endl;
		}
		++i;
		if(i ==2) break;
	}
}