A recently found Ancient Prophesy is believed to contain the exact Apocalypse date. The prophesy is a string that only consists of digits and characters "-".

We'll say that some date is mentioned in the Prophesy if there is a substring in the Prophesy that is the date's record in the format "dd-mm-yyyy". We'll say that the number of the date's occurrences is the number of such substrings in the Prophesy. For example, the Prophesy "0012-10-2012-10-2012" mentions date 12-10-2012 twice (first time as "0012-10-2012-10-2012", second time as "0012-10-2012-10-2012").

The date of the Apocalypse is such correct date that the number of times it is mentioned in the Prophesy is strictly larger than that of any other correct date.

A date is correct if the year lies in the range from 2013 to 2015, the month is from 1 to 12, and the number of the day is strictly more than a zero and doesn't exceed the number of days in the current month. Note that a date is written in the format "dd-mm-yyyy", that means that leading zeroes may be added to the numbers of the months or days if needed. In other words, date "1-1-2013" isn't recorded in the format "dd-mm-yyyy", and date "01-01-2013" is recorded in it.

Notice, that any year between 2013 and 2015 is not a leap year.

Input

The first line contains the Prophesy: a non-empty string that only consists of digits and characters "-". The length of the Prophesy doesn't exceed 105 characters.

Output

In a single line print the date of the Apocalypse. It is guaranteed that such date exists and is unique.

Examples

Input

777-444---21-12-2013-12-2013-12-2013---444-777


Output

13-12-2013
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class Main {

    public static String format(int d, int m, int y) {
        String ans = "";
        ans += (d < 10) ? "0" : "";
        ans += String.valueOf(d) + "-";
        ans += (m < 10) ? "0" : "";
        ans += String.valueOf(m) + "-";
        ans += String.valueOf(y);
        return ans;
    }
    
    public static String find(ArrayList<String> ll){
        Calendar date = new GregorianCalendar(2013, 1, 1);
        Calendar dateMax = new GregorianCalendar(2013, 1, 1);       
        String ans = "", d= "",m= "",y= "";
        String[] s;
        for (int i = 0; i < ll.size(); i++) {
            s = ll.get(i).split("-");
            date.set(Integer.parseInt(s[2]),Integer.parseInt(s[1]),Integer.parseInt(s[0]));
            if(date.compareTo(dateMax)>=0){
                dateMax = (GregorianCalendar)date.clone();
                d = s[0];
                m = s[1];
                y = s[2];
            }
        }
        ans = format(Integer.parseInt(d), Integer.parseInt(m), Integer.parseInt(y));
        return ans;
    }

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb = new StringBuilder();
        String line;
        int t = 0;
        int[] days = { 21, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
        do {
            line = br.readLine();
            if (line == null || line.length() == 0)
                break;
            //while (!line.replaceAll("--", "-").equals(line))
                //line = line.replaceAll("--", "-");
            ArrayList<String> ll = new ArrayList<String>();
            HashMap<String, Integer> hm = new HashMap<String, Integer>();           
            String[] dates = line.split("-");
            int d = 0, m = 0, y = 0, max = 0;
            int dmax = 0, mmax = 0, ymax = 2013;
            for (int i = 0; i < dates.length - 2; i++) {
                if (dates[i].length() >= 2 && dates[i + 1].length() >= 2) {
                    d = Integer
                            .parseInt(dates[i].substring(dates[i].length() - 2));
                    m = Integer.parseInt(dates[i + 1].substring(dates[i + 1]
                            .length() - 2));
                    if (m >= 1 && m <= 12 && d <= days[m - 1] && d > 0
                            && dates[i + 2].length() >= 4) {
                        y = Integer.parseInt(dates[i + 2].substring(0, 4));
                        if (y >= 2013 && y <= 2015) {
                                dmax = d;
                                mmax = m;
                                ymax = y;
                                String temp = format(dmax, mmax, ymax);
                                if(!hm.containsKey(temp)){
                                    hm.put(temp, 1);
                                    if(1>max){
                                        max = 1;
                                    }
                                }else{
                                    int aux = hm.get(temp);
                                    hm.put(temp, aux+1);
                                    if(aux+1>max){
                                        max = aux+1;
                                    }
                            }
                        }
                    }
                }
            }
             Set s = hm.entrySet();
             Iterator i = s.iterator();
             while (i.hasNext()) {
                 String[] aux =  i.next().toString().split("=");
                 if(Integer.parseInt(aux[1])==max){
                     ll.add(aux[0]);
                 }
             }
            sb.append(((t++==0)?"":"\n")+find(ll));
        } while (!line.equals("") && line != null);
        System.out.println(sb);
    }
}