from datetime import date, timedelta m, d, k = map(int, input().split()) tdy = date(year=2022, month=m, day=d) td = timedelta(days=1) cnt = [0] * 10 for i in range(7) : cnt[td.month // 10] += 1 cnt[td.month % 10] += 1 cnt[td.day // 10] += 1 cnt[td.day % 10] += 1 tdy += td sm = 0 for x in cnt : if x > 0 : sm += 1 print("Yes" if sm >= k else "No")