from datetime import date
from collections import OrderedDict
def is_legal(year,month,day,state):
if state:
temp=int("20"+year)
else:
temp = int("19" + year)
try:
date(temp,int(month),int(day))#判断是否合法
if temp<2060 and temp>1960:
return True
else:
return False
except ValueError:
return False
if __name__=='__main__':
answer=[]
a,b,c=input().split("/")
if is_legal(a,b,c,1):
answer.append("20"+a+'-'+b+'-'+c)
if is_legal(c,a,b,1):
answer.append("20" + c + '-' + a + '-' + b)
if is_legal(c,b,a,1):
answer.append("20" + c + '-' + b + '-' + a)
if is_legal(a,b,c,0):
answer.append("19"+a+'-'+b+'-'+c)
if is_legal(c,a,b,0):
answer.append("19" + c + '-' + a + '-' + b)
if is_legal(c,b,a,0):
answer.append("19" + c + '-' + b + '-' + a)
result=list(OrderedDict.fromkeys(answer))#去重
result.sort()
for i in result:
print(i)