import sys input = sys.stdin.readline from collections import * import datetime M, D, K = map(int, input().split()) d = datetime.date(2022, M, D) s = set() for _ in range(7): _, mm, dd = str(d).split('-') s.add(mm[0]) s.add(mm[1]) s.add(dd[0]) s.add(dd[1]) d += datetime.timedelta(days=1) if len(s)>=K: print('Yes') else: print('No')