####################################################
# -*- coding: utf-8 -*-
import sys

w = sys.stdout.write
read = sys.stdin.readline
reads = sys.stdin.read

def r(f=None):
    if f:
        return map(f, read().split())
    else:
        return read().split()

def rs(t,f=None):
    result = []
    result_append = result.append
    for i in xrange(t):
        if f:
            result_append(tuple(map(f, read().split())))
        else:
            result_append(list(read().split()))
    return result


####################################################
import math
sqrt = math.sqrt
from collections import deque

import re
s = read().replace('\n', '')
poss = re.finditer(r"(?=(\d\d-\d\d-\d\d\d\d))", s)
poss = [str(x.group(1)) for x in poss]
#print poss
res = {}

for p in poss:
    d, m, y = p.split('-')
    if y in ['2013', '2014', '2015']:
        if m in ['01', '03', '05', '07', '08', '10', '12'] and 0 < int(d) <= 31:
            res[p] = res.get(p, 0) + 1
        elif m in ['04', '06', '09', '11'] and 0 < int(d) <= 30:
            res[p] = res.get(p, 0) + 1
        elif m in ['02'] and 0 < int(d) <= 28:
            res[p] = res.get(p, 0) + 1

ma = 0
result = ''
for k in res:
    if res[k] > ma:
        ma = res[k]
        result = k

w(result)
