import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class B {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int[] days = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
        int[][][] cnt = new int[2016][13][32];
        String[] data = br.readLine().split("-");

        int max = 0;
        for (int i = 2; i < data.length; i++)
            if (data[i].length() >= 4) {
                int year = Integer.parseInt(data[i].substring(0, 4));
                if (year >= 2013 && year <= 2015) {
                    if (data[i - 1].length() == 2) {
                        int month = Integer.parseInt(data[i-1]);
                        if (month >= 1 && month <= 12) { 
                            if (data[i - 2].length() >= 2) {
                                int day = Integer.parseInt(data[i-2].substring(data[i-2].length()-2));
                                if (day >= 1 && day <= days[month]) {
                                    cnt[year][month][day]++;
                                    max = Math.max(cnt[year][month][day], max);
                                }
                            }
                        }
                    }
                }
            }

        for (int year = 2013; year <= 2015; year++)
            for (int month = 1; month <= 12; month++)
                for (int day = 1; day <= days[month]; day++)
                    if (cnt[year][month][day] == max) {
                        System.out.printf("%d-%d-%d\n", day, month, year);
                        System.exit(0);
                    }
    }
}
