import time from datetime import date from datetime import timedelta m, d, k = [int(v) for v in input().split()] f = date(2022, m, d) dic = dict() for i in range(7): d = timedelta(days = i) for c in str((f + d).day).zfill(2): if c not in dic: dic[c] = 1 else: dic[c] += 1 for c in str((f + d).month).zfill(2): if c not in dic: dic[c] = 1 else: dic[c] += 1 print("Yes" if len(dic) >= k else "No")