#include using namespace std; tuple input() { int a, b, c; scanf("%d.%d.%d", &a, &b, &c); return make_tuple(a, b, c); } int main() { tuple a = input(), b = input(); if (b <= a) cout << "YES" << endl; else cout << "NO" << endl; }