#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;

int y, m, d, year[] = { 1989, 1926, 1912, 1868 };
string s, table[] = { "heisei", "showa", "taisho", "meiji", "pre-meiji" };

int main(){
	while (cin >> y >> m >> d){
		if (y > 1989){
			s = table[0];
		}
		else if (y == 1989){
			if (m > 1){
				s = table[0];
			}
			else{
				if (d >= 8){
					s = table[0];
				}
				else{
					s = table[1];
				}
			}
		}
		else if (y > 1926){
			s = table[1];
		}
		else if (y == 1926){
			if (m == 12){
				if (d >= 25){
					s = table[1];
				}
				else{
					s = table[2];
				}
			}
			else{
				s = table[2];
			}
		}
		else if (y > 1912){
			s = table[2];
		}
		else if (y == 1912){
			if (m > 7){
				s = table[2];
			}
			else if(m==7){
				if (d >= 30){
					s = table[2];
				}
				else s = table[3];
			}
			else s = table[3];
		}
		else if (y > 1868){
			s = table[3];
		}
		else if (y == 1868){
			if (m > 9){
				s = table[3];
			}
			else if (m == 9){
				if (d >= 8)s = table[3];
				else s = table[4];
			}
			else s = table[4];
		}
		else s = table[4];
		REP(i, 4){
			if (s == table[i]){
				y -= year[i];
				y++;
			}
		}
		if (s == table[4]) cout << s << endl;
		else cout << s << " " << y << " " << m << " " << d << endl;
	}
}