import datetime as dt m,d,k=map(int,input().split()) a=dt.date(2022,m,d) b=[0]*10 for i in range(7): c=a+dt.timedelta(days=i) for j in (str(c.month)+str(c.day)).zfill(4): b[int(j)]=1 print('Yes') if sum(b)>=k else print('No')