//package Round_158;

import java.util.*;
import java.io.*;

import static java.lang.Math.*;

public class b {

	HashMap<String, Integer> hash = new HashMap<String, Integer>();
	
	String format(String a, String b, String c){
		String ans = a.substring(a.length()-2, a.length()) +" " +b.substring(b.length()-2, b.length()) +" "+ c;
		return ans;
	}
	
	String max = "";
	int maxx = 0;
	
	void r(String dd, String mm, String yy){
		//System.out.println(dd + " " + mm + " "+ yy);
		if (dd.length() < 2 || mm.length() < 2 || yy.length() != 4 
				|| Integer.parseInt(mm.substring(mm.length()-2, mm.length())) > 12 
				|| Integer.parseInt(yy) > 2015 
				|| Integer.parseInt(yy) < 2012) return;
		String ss = format(dd, mm, yy);
		if (hash.containsKey(ss)){
			int t = hash.get(ss) + 1;
			hash.put(ss, t);
		}else {
			hash.put(ss, 1);
		}
		//System.out.println(ss + " " + hash.get(ss));
		if (maxx < hash.get(ss)){
			maxx = hash.get(ss);
			max = ss;
		}
	}
	
	void solve() throws Exception {
		String line = in.next();
		/*StringTokenizer str = new StringTokenizer(line, "-");
		line = "";
		while (str.hasMoreTokens()){
			line += str.nextToken() + " ";
			//System.out.println(line);
		}*/
		String s[] = line.split("-");
		
		for (int i = 0; i<s.length-2; i++){
			r(s[i], s[i+1], s[i+2]);
		}
		
		
		out.println(max);
		
		
		
		
		
		
		
		
	}

	FastScanner in;
	PrintWriter out;

	String input = "";
	String output = "";

	void run() {
		try {
			if (input.length() > 0) {
				in = new FastScanner(new BufferedReader(new FileReader(input)));
			} else
				in = new FastScanner(new BufferedReader(new InputStreamReader(
						System.in)));
			if (output.length() > 0)
				out = new PrintWriter(new FileWriter(output));
			else
				out = new PrintWriter(System.out);

			solve();

			out.flush();
			out.close();
		} catch (Exception ex) {
			ex.printStackTrace();
			out.flush();
			out.close();
		} finally {
			out.close();
		}
	}

	public static void main(String[] args) {
		new b().run();
	}

	class FastScanner {
		BufferedReader bf;
		StringTokenizer st;

		public FastScanner(BufferedReader bf) {
			this.bf = bf;
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(bf.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public String nextLine() throws IOException {
			return bf.readLine();
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

	}

}
