import re
import time

def correct_date(s):
  try:
    date_obj = time.strptime(s, "%d-%m-%Y")
    return date_obj.tm_year >= 2013 and date_obj.tm_year <= 2015
  except:
    return False

def solve(s):
  date = re.compile("\\d{2}-\\d{2}-\\d{4}")
  corrects = dict()

  for c in date.findall(s):
    if correct_date(c):
      corrects[c] = corrects.get(c, 0) + 1

  print max(corrects, key=corrects.get)

string = str(raw_input())
solve(string)
