import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class B158 {
    static Map<Integer, Integer> dayMap = new HashMap<Integer, Integer>();
    static  {
        dayMap.put(1, 31);
        dayMap.put(2, 28);
        dayMap.put(3, 31);
        dayMap.put(4, 30);
        dayMap.put(5, 31);
        dayMap.put(6, 30);
        dayMap.put(7, 31);
        dayMap.put(8, 31);
        dayMap.put(9, 30);
        dayMap.put(10, 31);
        dayMap.put(11, 30);
        dayMap.put(12, 31);
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        ArrayList<String> dates = new ArrayList<String>();
        s = s.replaceAll("\\-+", "-");
        String REGEX = "[0-9]{2}-[0-9]{2}-2013|2014|2015";
        Pattern pattern = Pattern.compile(REGEX);
        Matcher matcher = pattern.matcher(s);
        while(matcher.find())
            dates.add(s.substring(matcher.start(),matcher.end()));

        for (int i = 0; i < dates.size(); i++) {
            int dd = Integer.valueOf(dates.get(i).substring(0,2));
            if(dd==13 || dd==14 ||dd==15){
                int mm = Integer.valueOf(dates.get(i).substring(3, 5));
                if(mm>0 && mm<13 && dd<dayMap.get(mm)){
                    System.out.println(dates.get(i));
                    break;
                }
            }

        }
    }
}
