def get_days(mm, yy):
	if mm in [1, 3, 5, 7, 8, 10, 12]:
		return 31
	elif mm in [4, 6, 9, 11]:
		return 30
	else:
		return 29 if yy % 4 == 0 and yy % 100 != 0 else 28
is_correct_date = lambda (a, b, c) : b >= 1 and b <= 12 and a >= 1 and a <= get_days(b, c)
a, b, c = map(int, open('chronicle.in').read().split('/'))
ans = set(filter(is_correct_date, [(a, b, c), (a, c, b), (b, a, c), (b, c, a), (c, a, b), (c, b, a)]))
open('chronicle.out', 'w').write('\n'.join('%02d/%02d/%02d'%(a, b, c) for a, b, c in ans) + '\n' if len(ans) != 0 else 'No such date\n')
