string = raw_input()
year = ['-2015-', '-2014-', '-2013-']
d = ['32', '29', '32', '31', '32', '31', '32', '32', '31', '32', '31', '32']
flag = False
for y in year:
    if flag:
        break
    tmp = string
    p = tmp.find(y)
    while p != -1:
        if cmp(tmp[p - 3], '-') == 0:
            month = tmp[p - 2:p]
            if cmp(month, '00') > 0 and cmp(month, '13') < 0:
                day = tmp[p - 5: p - 3]
                if cmp(day, '00') > 0 and cmp(day, d[int(month) - 1]) < 0:
                    print day + '-' + month + y[0:5]
                    break
        tmp = tmp[p + 3:]
        p = tmp.find(str(y))
