#include using namespace std; using ll = long long; using pll = pair; #define drep(i, cc, n) for (ll i = (cc); i <= (n); ++i) #define rep(i, n) drep(i, 0, n - 1) #define all(a) (a).begin(), (a).end() #define pb push_back #define fi first #define se second const ll MOD = 1000000007; const ll MOD2 = 998244353; const ll INF = 1LL << 60; const ll MAX_N = 2e5; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); ll m, d, k; cin >> m >> d >> k; vector M(7), D(7); for(ll i=0; i<7; i++){ if(m==1 || m==3 || m==5 || m==7 || m==8 || m==10 || m==12){ if(d+i>31){ M[i]=m+1; D[i]=d+i-31; }else{ M[i]=m; D[i]=d+i; } }else if(m==2){ if(d+i>28){ M[i]=m+1; D[i]=d+i-28; }else{ M[i]=m; D[i]=d+i; } }else if(m==4 || m==6 || m==9 || m==11){ if(d+i>30){ M[i]=m+1; D[i]=d+i-30; }else{ M[i]=m; D[i]=d+i; } } } vector check(10, false); rep(i, 7){ check[M[i]/10]=true; check[M[i]%10]=true; check[D[i]/10]=true; check[D[i]%10]=true; } ll cnt = 0; rep(i, 10) cnt+=check[i]; if(cnt>=k) cout << "Yes" << endl; else cout << "No" << endl; }