#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <string>
#include <cmath>
#include <cfloat>
#include <map>
using namespace std;
int main(){
	
	int y,m,d;
	string s;
	
	while(cin>>y>>m>>d){
		if(y<1868)
			s="pre-meiji";
		else if(y==1868){
			if(m<9)
			s="pre-meiji";
			else if(m==9){
				if(d<8)
				s="pre-meiji";
				else{
				s="meiji";
					y=1;
				}
			}
			else{
				s="meiji";
				y=1;
			}	
		}
		else if(y<1912){
			s="meiji";
			y=y-1868+1;
		}
		else if(y==1912){
			if(m<7){
				s="meiji";
				y=y-1868+1;
			}
			else if(m==7){
				if(d<=29){
					s="meiji";
					y=y-1868+1;
				}
				else{
					s="taisho";
					y=1;
				}
			}
			else{
				s="taisho";
				y=1;
			}
		}
		else if(y<1926){
			s="taisho";
			y=y-1912+1;
		}
		else if(y==1926){
			if(m<12){
				s="taisho";
				y=y-1912+1;
			}
			else{
				if(d<=24){
					s="taisho";
					y=y-1912+1;
				}
				else{
					s="showa";
					y=1;
				}
			}
		}
		else if(y<1989){
			s="showa";
			y=y-1926+1;
		}
		else if(y==1989){
			if(m==1){
				if(d<=7){
					s="showa";
					y=y-1926+1;
				}
				else{
					s="heisei";
					y=1;
				}
			}
				else{
					s="heisei";
					y=1;
				}
			}
		else{
			s="heisei";
			y=y-1989+1;
		}
		if(s=="pre-meiji")
			cout<<s<<endl;
		else
			cout<<s<<" "<<y<<" "<<m<<" "<<d<<endl;
		}
	
}