#include using namespace std; #define rep(i,n) for(int i = 0; i < (int)(n); ++i) #define rrep(i,n) for(int i = (int)(n) - 1; i >= 0; --i) #define ALL(a) a.begin(), a.end() #define Sort(a) sort(a.begin(), a.end()) #define RSort(a) sort(a.rbegin(), a.rend()) typedef long long int ll; typedef long double ld; typedef vector vi; typedef vector vll; typedef vector vc; typedef vector vst; typedef vector vd; typedef pair P; const long long INF = 0x1fffffffffffffff; const long long MOD = 998244353; const long double PI = acos(-1); template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } template inline T vin(T& vec, U n) { vec.resize(n); for(int i = 0; i < (int) n; ++i) cin >> vec[i]; return vec; } template inline void vout(T vec, string s = "\n"){ for(auto x : vec) cout << x << s; } template void in(T&... a){ (cin >> ... >> a); } void out(){ cout << '\n'; } template void out(const T& a, const Ts&... b){ cout << a; (cout << ... << (cout << ' ', b)); cout << '\n'; } template void inGraph(vector>& G, U n, U m, bool directed = false){ G.resize(n); for(int i = 0; i < m; i++){ int a, b; cin >> a >> b; a--, b--; G[a].push_back(b); if(!directed) G[b].push_back(a); } } vector day = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; ll m, d, k; void input(){ in(m, d, k); } void solve(){ vector check(10); rep(i, 7){ check[m / 10] = 1; check[m % 10] = 1; check[d / 10] = 1; check[d % 10] = 1; if(d == day[m - 1]){ m++; d = 1; if(m > 12) m = 1; }else{ d++; } } ll cnt = 0; rep(i, 10) cnt += check[i]; if(cnt >= k){ out("Yes"); }else{ out("No"); } } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); input(); solve(); }