m, d, k = map(int, input().split()) M = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] nums = set() for _ in range(7): sm = f"{m:02}" nums.add(int(sm[0])) nums.add(int(sm[1])) sd = f"{d:02}" nums.add(int(sd[0])) nums.add(int(sd[1])) d += 1 if d > M[m]: d = 1 m += 1 if m == 13: m = 1 if len(nums) >= k: print("Yes") else: print("No")