from datetime import date, timedelta M, D, K = map(int, input().split()) appear = [False] * 10 date = date(2023, M, D) for i in range(7): m = date.month d = date.day for _ in range(2): appear[m % 10] = appear[d % 10] = True m //= 10 d //= 10 date += timedelta(days=1) isOK = appear.count(True) >= K print("Yes" if isOK else "No")