import java.util.Hashtable;
import java.util.Scanner;

public class Ancientprophesy {
	public static void main(String[] args) {
		int[] months = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
		Hashtable<String, Integer> time = new Hashtable<String, Integer>();
		String maxS = "";
		int max = 0;
		Scanner in = new Scanner(System.in);
		String s = in.nextLine();
		String[] temp = s.split("-");
		for(String x:temp)
			System.out.println(x);
		for (int i = 0; i < temp.length - 2; i++) {
			String date = "";
			int day = 0;
			int month = 0;
			int year = 0;
			if (temp[i].length() >= 2) {
				String d = temp[i].substring(temp[i].length() - 2,
						temp[i].length());
				day = Integer.parseInt(d);
				date += d + "-";
			} else
				continue;
			if (temp[i + 1].length() >= 2) {
				String d = temp[i+1].substring(temp[i+1].length() - 2,
						temp[i+1].length());
				month = Integer.parseInt(d);
				date += d+"-";
			} else
				continue;
			if (temp[i + 2].length() >= 4) {
				String d = temp[i+2].substring(temp[i+2].length() - 4,
						temp[i+2].length());
				year = Integer.parseInt(d);
				date += d;
			}
			if (year < 2013 || year > 2015)
				continue;
			if (day <= 0 || day > months[month])
				continue;
			int times=1;
			if(time.containsKey(date)){
				time.put(date, time.get(date)+1);
				times=time.get(date)+1;
			}
			else
				time.put(date, 1);
			if(times>max){
				max=times;
				maxS=date;
			}
				
		}
		System.out.println(maxS);
	}
}
