<?php
           
              
			while(fscanf(STDIN, "%d%d%d", $a, $b, $c)){
                if(($a >= 1989 && $b >= 1 && $c >= 8) || ($a >= 1989 && $b >= 2) || ($a >= 1990)) {
                    $a -= 1988;
                    print("heisei $a $b $c\n");
                }
                else{
                    if(($a >= 1926 && $b >= 12 && $c >= 25) || ($a >= 1927)){
                        $a -= 1925;
                        print("showa $a $b $c\n");
                    }
                    else{
                        if(($a >= 1912 && $b >= 7 && $c >= 30) || ($a >= 1912 && $b >= 8) || ($a >= 1913)){
                            $a -= 1911;
                            print("taisho $a $b $c\n");
                        }
                        else{
                            if(($a >= 1868 && $b >= 9 && $c >= 8) || ($a >= 1868 && $b >= 10) || ($a >= 1869)){
                                $a -= 1867;
                                print("meiji $a $b $c\n");
                            }
                            else{
                                print("pre-meiji\n");
                            }
                        }
                    }
                }
        
            }
            
           
		?>