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.util.*;
import java.io.*;

/**
 *
 * @author mohanad
 */
public class Div2_260B {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException {
        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
        String s = bf.readLine();
        String ans[] = {"00", "-", "00", "-", "0000"};

        int len = s.length();
        int i = 0;
        String monrtLen[] = {"00", "31", "28", "31", "30", "31", "30", "31", "31", "30", "31", "30", "31"};
        List<String> list = new LinkedList<String>();
        int counter[] = new int[100001];
        while (i <= len - 10) {

            String date = s.substring(i, i + 10);
            char[] charDate = date.toCharArray();

            String yyyy, mm, dd;
            if (charDate.length < 10 || charDate[2] != '-' || charDate[5] != '-') {
                ++i;
                continue;
            }
            yyyy = charDate[6] + "" + charDate[7] + "" + charDate[8] + "" + charDate[9];
            if (charDate[6] == '-' || charDate[7] == '-' || charDate[8] == '-' || charDate[9] == '-' || yyyy.compareTo("2013") < 0
                    || yyyy.compareTo("2015") > 0) {
                ++i;
                continue;
            }

            mm = charDate[3] + "" + charDate[4];
            if (charDate[3] == '-' || charDate[4] == '-' || mm.compareTo("00") <= 0 || mm.compareTo("12") > 0) {
                ++i;
                continue;
            }

            String monthl;
            if (charDate[3] == '0') {
                monthl = monrtLen[charDate[4] - '0'];
            } else {
                monthl = monrtLen[Integer.parseInt(mm)];
            }

            dd = charDate[0] + "" + charDate[1];
            if (charDate[0] == '-' || charDate[1] == '-' || dd.compareTo(monthl) > 0 || dd.compareTo("00") <= 0) {
                ++i;
                continue;
            }

//            if (dd.compareTo(ans[0])>=0 && mm.compareTo(ans[2])>=0 || yyyy.compareTo(ans[4])>=0){
//                ans[0]=dd;
//                ans[2] = mm;
//                ans[4] = yyyy;
//            }
//            //31-05-201501-12-201363-18-201501-12-31-05-2015-201395301-12-201301-12-20132939131-05-201578-11-201301-12-20132196-14-201075-00-201501-12-201301-12-2013801-12-20131-05-2015301-12-201301-12-20139-59-18-20129101-12-201301-12-201301-12-201319-29-100401-12-20131-05-201531-05-2015-99031-05-201531-05-201531-05-20154-38101-12-201301-12-20131601-12-20131-05-201545101-12-201329131-05-201501-12-201395841-03-201658201-12-201301-12-20133701-12-201345-08-201701-12-201301-12-20131-05-201555165-02-102236-3931-05-20159024-801-12-201301-12-2013
//            boolean flag = false;
//            if (yyyy.compareTo(ans[4]) > 0) {
//                flag = true;
//            } else if (yyyy.compareTo(ans[4]) == 0 && mm.compareTo(ans[2]) > 0) {
//                flag = true;
//            } else if (dd.compareTo(ans[0]) > 0 && mm.compareTo(ans[2]) >= 0 || yyyy.compareTo(ans[4]) >= 0) {
//                flag = true;
//            }
//            if (flag) {
//                ans[0] = dd;
//                ans[2] = mm;
//                ans[4] = yyyy;
//            }

            //
            String countes = dd + "-" + mm + "-" + yyyy;
            int l = list.size();
            boolean visted = false;
            int j = 0;
            for (j = 0; j < l; ++j) {
                if (countes.equals(list.get(j))) {
                    visted = true;
                    break;
                }
            }
            if (visted) {
                ++counter[j];
            } else {
                list.add(countes);
                ++counter[j];
            }

            ++i;
        }

        int max = 0;
        int l = list.size();
        for (int t = 1; t < l; ++t) {
            if (counter[t] > counter[max]) {
                max = t;
            }
        }
        System.out.println(list.get(max));
    }

}
