#define _USE_MATH_DEFINES
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>

using namespace std;

int main(){
	int y,m,d;
	while(cin>>y>>m>>d){
		if(y < 1867 || y <= 1868 && (m <= 8 || m <= 9 && d <= 8)){
			puts("pre-meiji"); continue;
		} else if(y < 1911 || y <= 1912 && (m <= 6 || m <= 7 && d <= 30)){
			printf("meiji %d %d %d\n",y - 1867,m,d); continue;
		} else if(y < 1925 || y <= 1926 && (m <= 11 || m <= 12 && d <= 25)){
			printf("taisho %d %d %d\n",y - 1911,m,d); continue;
		} else if(y < 1988 || y <= 1989 && (m == 1 && d <= 7)){
			printf("showa %d %d %d\n",y - 1925,m,d); continue;
		} else {
			printf("heisei %d %d %d\n",y - 1988,m,d); continue;
		}
	}
    return 0;
}