from datetime import datetime, date, timedelta M, D, K = map(int, input().split()) now = datetime(year=1, month=M, day=D) done = set() for i in range(7): s = str(now.month).zfill(2) done.add(s[0]) done.add(s[1]) s = str(now.day).zfill(2) done.add(s[0]) done.add(s[1]) now += timedelta(1) if len(done) >= K: print('Yes') else: print('No')