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

public class chronicle_av {

	int[] days = new int[]{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
	
	boolean correct(String a, String b, String c) {
		int x = Integer.parseInt(a);
		int y = Integer.parseInt(b);
		int z = Integer.parseInt(c);
		if (y == 0 || y > 12)
			return false;
		int d = days[y - 1];
		if (y == 2 && z % 4 == 0 && z != 0)
			d++;
		if (x > d || x < 1)
			return false;
		return true;
	}
	
	void solve() throws Exception {
		String s = nextToken();
		StringTokenizer st = new StringTokenizer(s, "/ ");
		TreeSet<String> ts = new TreeSet<String>();
		String s1 = st.nextToken();
		String s2 = st.nextToken();
		String s3 = st.nextToken();
		if (correct(s1, s2, s3)) {
			ts.add(s1 + "/" + s2 + "/" + s3);
		}
		if (correct(s1, s3, s2)) {
			ts.add(s1 + "/" + s3 + "/" + s2);
		}
		if (correct(s2, s1, s3)) {
			ts.add(s2 + "/" + s1 + "/" + s3);
		}
		if (correct(s2, s3, s1)) {
			ts.add(s2 + "/" + s3 + "/" + s1);
		}
		if (correct(s3, s1, s2)) {
			ts.add(s3 + "/" + s1 + "/" + s2);
		}
		if (correct(s3, s2, s1)) {
			ts.add(s3 + "/" + s2 + "/" + s1);
		}
		if (ts.isEmpty()) {
			out.println("No such date");
		} else {
			for (String t : ts)
				out.println(t);
		}
	}

	void run() {
		try {
			in = new BufferedReader(new FileReader(filename + ".in"));
			out = new PrintWriter(filename + ".out");
			//			in = new BufferedReader(new InputStreamReader(System.in));
			//			out = new PrintWriter(System.out);

			solve();

			out.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
	}

	BufferedReader in;
	StringTokenizer st;
	PrintWriter out;
	final String filename = new String("chronicle").toLowerCase();

	String nextToken() throws Exception {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(in.readLine());
		return st.nextToken();
	}

	int nextInt() throws Exception {
		return Integer.parseInt(nextToken());
	}

	long nextLong() throws Exception {
		return Long.parseLong(nextToken());
	}

	double nextDouble() throws Exception {
		return Double.parseDouble(nextToken());
	}

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

}
