M,D,K=map(int,input().split()) A=[] import datetime now=datetime.datetime(2022,M,D) for i in range(K): for j in range(5,7): A.append(str(now)[j]) for j in range(8,10): A.append(str(now)[j]) now+=datetime.timedelta(days=1) if len(set(A))>=K: print('Yes') else: print('No')