from re import compile
from collections import defaultdict
from time import strptime

def validDate(date):
    try:
        strptime(date, "%d-%m-%Y")
        return True
    except:
        return False

myFormat = compile(r'(?=([0-2]\d|3[0-1])-(0\d|1[0-2])-(201[3-5]))' )
Dict = defaultdict(int)
for d in myFormat.finditer(input()):
    temp = "-".join([d.group(1),d.group(2),d.group(3)])
    if validDate (temp):
        Dict[temp] = -~Dict[temp]
print(max(Dict, key=Dict.get))