#include <bits/stdc++.h>
using namespace std;

#ifdef _RUTHEN
#include <debug.hpp>
#else
#define show(...) true
#endif

using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
template <class T> using V = vector<T>;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    V<int> d = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    int M, D, K;
    cin >> M >> D >> K;
    set<char> S;
    rep(i, 7) {
        string ms = to_string(M), ds = to_string(D);
        if (ms.size() == 1) ms = "0" + ms;
        if (ds.size() == 1) ds = "0" + ds;
        for (auto c : ms) S.insert(c);
        for (auto c : ds) S.insert(c);
        if (d[M - 1] == D) {
            D = 1;
            M++;
            if (M == 13) M = 1;
        } else {
            D++;
        }
    }
    cout << (S.size() >= K ? "Yes" : "No") << '\n';
    return 0;
}