import datetime m,d,k=map(int,input().split()) times = set() d=datetime.date(2001,m,d) for i in range(7): for n in str(d.month).zfill(2): times.add(n) for n in str(d.day).zfill(2): times.add(n) d=d+datetime.timedelta(days=1) if len(times) >= k: print("Yes") else: print("No")