from datetime import date, timedelta m, d, k = map(int, input().split()) t = date(2022, m, d); s = set() for i in range(7): for v in (t+timedelta(days=i)).strftime('%m%d'): s.add(v) print("Yes" if len(s) >= k else "No")