M,D,K = map(int,input().split())
check = set()
R = {4,6,9,11}
for i in range(7):
  if len(str(M)) == 1:
    check.add('0')
  if len(str(D)) == 1:
    check.add('0')
  for j in list(str(M)):
    check.add(j)
  for j in list(str(D)):
    check.add(j)
  D += 1
  if D == 29 and M == 2:
    M = 3
    D = 1
    continue
  if D == 31:
    if M in R:
      M += 1
      D = 1
      continue
  if D == 32:
    D = 1
    M = (M%12) + 1

if len(check) >= K:
  print('Yes')
else:
  print('No')