import datetime m,d,k = map(int,input().split()) today = datetime.date(2022,m,d) ans = set() for i in range(7): s = str(today).split("-")[1:] for x in "".join(s): ans.add(x) today = today + datetime.timedelta(days=1) if len(ans) >= k: print("Yes") else: print("No")