def solve():
    M,D,K=map(int,input().split())

    X=[0,31,28,31,30,31,30,31,31,30,31,30,31]
    S=set()
    for _ in range(7):
        S|=set(str(M).zfill(2))
        S|=set(str(D).zfill(2))

        if X[M]==D:
            D=1
            M=(M+1)%12+1
        else:
            D+=1
    return len(S)>=K

#==================================================
print("Yes" if solve() else "No")