a, b, c = input().split('/')
# 有年/月/日,月/日/年,日/月/年共三种输入情况,lt意为将这三种情况重新排成年/月/日,然后判断
lt = [(a, b, c), (c, b, a), (c, a, b)]
error = [] # 用来存储错误的
for i in lt: # 判断正误
# i[1]是月份,大于0小于13,i[2]为日,大于0
if int(i[1]) > 12 or int(i[1]) == 0 or int(i[2]) == 0:
error.append(i)
else:
if int(i[1]) == 2: # 二月份独特,单独处理
if int(i[0]) % 4 == 0: # 因为能被100整除的年份只有2000,且知是闰年,所以直接按普通闰年判断
if int(i[2]) > 29:
error.append(i)
elif int(i[2]) > 28:
error.append(i)
elif int(i[1]) in [1, 3, 5, 7, 8, 10, 12]: # 大月31天
if int(i[2]) > 31:
error.append(i)
else: # 小月30天
if int(i[2]) > 30:
error.append(i)
lt = list(set(lt)) # 去重
lt.sort() # 排序
for i in lt:
if i not in error:
if int(i[0]) < 60:
print('20%s-%s-%s' % i)
else:
print('19%s-%s-%s' % i)