#include using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); vector lm = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; int m, d, k; cin >> m >> d >> k; --m; stringstream ss; for (int i = 0; i < 7; ++i) { ss << setw(2) << setfill('0') << m + 1 << setw(2) << setfill('0') << d; ++d; if (d > lm[m]) d = 1, ++m; if (m == 12) m = 0; } string tot = ss.str(); ranges::sort(tot); tot.erase(ranges::unique(tot).begin(), tot.end()); if ((int)tot.size() >= k) cout << "Yes\n"; else cout << "No\n"; }