m, d, k = map(int, input().split()) day = [31] * 13 day[2] = 28 day[4] = 30 day[6] = 30 day[9] = 30 day[11] = 30 def nex(m, d): if day[m] == d: d = 1 m += 1 if m == 13: m = 1 return m, d return m, d + 1 se = set() def add(x): se.add(x // 10) se.add(x % 10) for _ in range(7): add(m) add(d) m, d = nex(m, d) if len(se) >= k: print("Yes") else: print("No")