m, d, k = map(int, input().split()) mon = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] res = set() for _ in range(7): if d > mon[m-1]: d %= mon[m-1] m = (m+1) % 12 mm = str(m).zfill(2) dd = str(d).zfill(2) #print(mm, dd) for i in mm+dd: res.add(i) d += 1 #print(res) if len(res) >= k: print('Yes') else: print('No')