import datetime m, d, k = map(int, input().split()) t = datetime.date(2022, m, d) a = "" for i in range(7): a += str(t+datetime.timedelta(days=1*i)) if len(set(list(a))) - 1 < k: print("No") else: print("Yes")