import datetime M,D,K=map(int,input().split()) x=datetime.date(2022,M,D) y=[0]*10 for i in range(7): z=x+datetime.timedelta(days=i) for j in (str(z.month)+str(z.day)).zfill(4): y[int(j)]=1 if sum(y)>=K: print("Yes") else: print("No")