import datetime m,d,k=map(int,input().split()) t=datetime.date(2022,m,d) a="" for i in range(7): a+=str(t+datetime.timedelta(days=i))[5:] print("Yes"if len(set(list(a)))>k else "No")