#include #include #include #include #include #define all(x) x.begin(),x.end() #define pb push_back #define ll long long #define P pair #define LP pair using namespace std; int main() { bool k = 0; int a,b,c,e,f,g; char u,v,w,x; cin >> a >> u >> b >> v >> c >> e >> w >> f >> x >> g; if (a > e) k = 1; else if (a == e) { if (b > f) k = 1; else if (b == f) { if (c >= g) k = 1; } } if (k) cout << "YES" << endl; else cout << "NO" << endl; return 0; }