def put_era(day):

  if day < [1868, 9, 8]:

    print("pre-meiji")

  

  elif day <= [1912, 7, 29]:

    print((*["meiji",day[0] - 1868 + 1, day[1], day[2]]))

  

  elif day <= [1926, 12, 24]:

    print((*["taisho",day[0] - 1912 + 1, day[1], day[2]]))

  

  elif day <= [1989, 1, 7]:

    print((*["showa",day[0] - 1926 + 1, day[1], day[2]]))

  

  else:

    print((*["heisei",day[0] - 1989 + 1, day[1], day[2]]))



while True:

  try:

    day = list(map(int, input().split()))

    put_era(day)



  except EOFError:

    break

def put_era(day):

  if day < [1868, 9, 8]:

    print("pre-meiji")

  

  elif day <= [1912, 7, 29]:

    print(("meiji",day[0] - 1868 + 1, day[1], day[2]))

  

  elif day <= [1926, 12, 24]:

    print(("taisho",day[0] - 1912 + 1, day[1], day[2]))

  

  elif day <= [1989, 1, 7]:

    print(("showa",day[0] - 1926 + 1, day[1], day[2]))

  

  else:

    print(("heisei",day[0] - 1989 + 1, day[1], day[2]))



while True:

  try:

    day = list(map(int, input().split()))

    put_era(day)



  except EOFError:

    break

def put_era(day):
    if day < [1868, 9, 8]:
        print("pre-meiji")
    elif day <= [1912, 7, 29]:
        print((*["meiji", day[0] - 1868 + 1, day[1], day[2]]))
    elif day <= [1926, 12, 24]:
        print((*["taisho", day[0] - 1912 + 1, day[1], day[2]]))
    elif day <= [1989, 1, 7]:
        print((*["showa", day[0] - 1926 + 1, day[1], day[2]]))
    else:
        print((*["heisei", day[0] - 1989 + 1, day[1], day[2]]))


while True:
    try:
        day = list(map(int, input().split()))
        put_era(day)
    except EOFError:
        break

def put_era(day):
    if day < [1868, 9, 8]:
        print("pre-meiji")
    elif day <= [1912, 7, 29]:
        print(("meiji", day[0] - 1868 + 1, day[1], day[2]))
    elif day <= [1926, 12, 24]:
        print(("taisho", day[0] - 1912 + 1, day[1], day[2]))
    elif day <= [1989, 1, 7]:
        print(("showa", day[0] - 1926 + 1, day[1], day[2]))
    else:
        print(("heisei", day[0] - 1989 + 1, day[1], day[2]))


while True:
    try:
        day = list(map(int, input().split()))
        put_era(day)
    except EOFError:
        break

-        print((*["meiji", day[0] - 1868 + 1, day[1], day[2]])) +        print(("meiji", day[0] - 1868 + 1, day[1], day[2])) -        print((*["taisho", day[0] - 1912 + 1, day[1], day[2]])) +        print(("taisho", day[0] - 1912 + 1, day[1], day[2])) -        print((*["showa", day[0] - 1926 + 1, day[1], day[2]])) +        print(("showa", day[0] - 1926 + 1, day[1], day[2])) -        print((*["heisei", day[0] - 1989 + 1, day[1], day[2]])) +        print(("heisei", day[0] - 1989 + 1, day[1], day[2]))