from datetime import date, timedelta m, d, k = map(int, input().split()) t = date(2023, m, d) td = timedelta(days=1) f = "%m%d" s = [] for i in range(7): s.append((t + i * td).strftime(f)) ans = set() for i in s: for j in i: ans.add(j) if len(ans) >= k: print("Yes") else: print("No")