#include #define rep(i, n) for (int i = 0; i < n; ++i) using ll = long long; using namespace std; const int INF = 1e9; int main() { int a, b, c, d, e, f; scanf("%d.%d.%d", &a, &b, &c); scanf("%d.%d.%d", &d, &e, &f); if (a * 1000000 + b * 1000 + c > d * 1000000 + e * 1000 + f) cout << "YES"; else cout << "NO"; cout << endl; return 0; }