#include using namespace std; typedef long long int ll; typedef pair P; typedef vector VI; typedef vector VVI; #define REP(i,n) for(int i=0;i<(n);i++) #define ALL(v) v.begin(),v.end() template bool chmax(T &x, const T &y) {return (x bool chmin(T &x, const T &y) {return (x>y)?(x=y,true):false;}; constexpr ll MOD=998244353; constexpr ll INF=2e18; int main(){ int m, d, k; cin >> m >> d >> k; VI x={31,28,31,30,31,30,31,31,30,31,30,31}; set s; REP(_,7){ s.insert(m/10); s.insert(m%10); s.insert(d/10); s.insert(d%10); if(d++==x[m-1]){ d=1; if(m++==12) m=1; } } if((int)s.size()>=k) cout << "Yes" << endl; else cout << "No" << endl; return 0; }