import sys input = lambda: sys.stdin.readline().rstrip() import math, random from bisect import bisect_right, bisect_left from itertools import product, permutations, combinations, combinations_with_replacement from collections import deque, defaultdict, Counter from heapq import heapify, heappush, heappop from functools import lru_cache, reduce inf = float('inf') def error(*args, sep=' ', end='\n'): print(*args, sep=sep, end=end, file=sys.stderr) def ltos(a, f=str, sep=' '): return sep.join(map(f, a)) # mod = 1000000007 # mod = 998244353 # sys.setrecursionlimit(10**6) # ----------------------- # m, d, k = map(int, input().split()) a = [] for i in range(7): s = f'{str(m).zfill(2)}{str(d).zfill(2)}' a.extend(list(s)) d += 1 if m in {4,6,9,11}: if d == 31: m += 1 d = 1 elif m == 2: if d == 29: m += 1 d = 1 else: if d == 32: m += 1 d = 1 m %= 12 a = set(a) print('Yes' if len(a) >= k else 'No')