#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <queue>
#include <set>
#include <map>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <bitset>
#include <complex>
using namespace std;

const double EPS = 1e-9;
const double PI = 3.14159265359;

typedef complex<double> P;

class ERA{
public:
	int y1, m1, d1;
	int y2, m2, d2;

	ERA(int year1, int month1, int day1, int year2, int month2, int day2){
		y1 = year1;
		m1 = month1;
		d1 = day1;
		y2 = year2;
		m2 = month2;
		d2 = day2;
	}
	bool isContain(int year, int month, int day){
		bool ret = false;
		if(year == y1 && year == y2){
			// 省略
		}else if(year == y1){
			if(month > m1){
				ret = true;
			}else if(month == m1){
				if(day >= d1){
					ret = true;
				}
			}
		}else if(year == y2){
			if(month < m2){
				ret = true;
			}else if(month == m2){
				if(day <= d2){
					ret = true;
				}
			}
		}else if(year > y1 && year < y2){
					ret = true;
		}
		return ret;
	}
};

int main(){
	int y, m, d;

	ERA pre_meiji(0, 0, 0, 1868, 9, 7);
	ERA meiji(1868, 9, 8, 1912, 7, 29);
	ERA taisho(1912, 7, 30, 1926, 12, 24);
	ERA showa(1926, 12, 25, 1989, 1, 7);

	while(cin >> y >> m >> d){
		if(pre_meiji.isContain(y, m, d)){
			cout << "pre-meiji" << endl;
		}else if(meiji.isContain(y, m, d)){
			cout << "meiji" << ' ' << y+1-meiji.y1 << ' ' << m << ' ' << d << endl;
		}else if(taisho.isContain(y, m, d)){
			cout << "taisho" << ' ' << y+1-taisho.y1 << ' ' << m << ' ' << d << endl;
		}else if(showa.isContain(y, m, d)){
			cout << "showa" << ' ' << y+1-showa.y1 << ' ' << m << ' ' << d << endl;			
		}else{
			cout << "heisei" << ' ' << y+1-showa.y2 << ' ' << m << ' ' << d << endl;
		}
	}

	return 0;
}