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.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.Comparator;
import java.util.InputMismatchException;
import java.util.Scanner;

public class CF260B{
    static class InputReader {

        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String nextLine() {
            return readString();
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }

    static class SuffixArray {
        public Integer[] sa;
        public int[] rank;
        public int[] height;
        public int n;
        public String str;
        SACmp cmp;

        public SuffixArray(String str){
            this.str = str;
            this.n = str.length();
            sa = new Integer[n+1];
            rank = new int[n+1];
            height = new int[n+1];
            cmp = new SACmp();
            constructSA();
            constructH();
        }

        private void constructSA(){
            for (int i=0; i<=n; i++) {
                rank[i] = i<n?str.charAt(i):-1;
                sa[i] = i;
            }
           Arrays.sort(sa, cmp);
            int[] tmp = new int[n+1];
            for (int k=1; k<n; k*=2){
                cmp.k = k;
                Arrays.sort(sa, cmp);
                tmp[sa[0]] = 0;
                for (int i=1; i<=n; i++){
                    tmp[sa[i]] = tmp[sa[i-1]]+Math.min(1, cmp.compare(sa[i], sa[i-1]));
                }
                for (int i=0; i<=n; i++) {
                    rank[i] = tmp[i];
                }
            }
            for (int i=0; i<=n; i++){
                rank[sa[i]] = i;
            }
        }

        private void constructH(){
            int h = 0;
            for (int i=0; i<n; i++){
                int j = sa[rank[i]-1];
                if (h>0) h--;
                while (i+h<n&&j+h<n&&str.charAt(i+h)==str.charAt(j+h)){
                    h++;
                }
                height[rank[i]] = h;
            }
        }

        private class SACmp implements Comparator<Integer> {
            public int k;

            @Override
            public int compare(Integer x, Integer y){
                if (rank[x]!=rank[y]) return rank[x]-rank[y];
                else {
                    int rx = x+k<n?rank[x+k]:-1;
                    int ry = y+k<n?rank[y+k]:-1;
                    return rx-ry;
                }
            }
        }
    }

    static int[] days = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

    static boolean isDate(String str){
        String[] num = str.split("-");
        if (num.length!=3){
            return false;
        }
        int[] numint = new int[3];
        try{
            for (int i=0; i<3; i++){
                if (i<2&&num[i].length()!=2){
                    return false;
                }
                numint[i] = Integer.valueOf(num[i]);
            }
        } catch (NumberFormatException e){
            return false;
        }
        return numint[1]>=1&&numint[1]<=12
            && numint[0]>=1&&numint[0]<=days[numint[1]]
            && numint[2]>=2013&&numint[2]<=2015;
    }

    public static void main(String[] args){
        InputReader scn = new InputReader(System.in);
        String str = scn.nextLine();
        SuffixArray sa = new SuffixArray(str);
        int cnt = 0;
        int max = 0;
        String ans = "", pre = "";
        int n = str.length();
        boolean hasDate = false;
        for (int i=1; i<=n; i++){
            if (sa.sa[i]+10<=n){
                String now = str.substring(sa.sa[i], sa.sa[i]+10);
                if (hasDate&&sa.height[i]>=10){
                    cnt ++;
                } else{
                    if (cnt>max){
                        ans = pre;
                        max = cnt;
                    }
                    if (isDate(now)){
                        cnt = 1;
                        pre = now;
                        hasDate = true;
                    } else {
                        hasDate = false;
                    }
                }
            }
        }
        if (cnt>max){
            ans = pre;
            max = cnt;
        }
        System.out.println(ans);
    }
}