#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define INF (1 << 30) #define INFLL (1LL << 60) int main() { char kon; int a1,a2,a3; int b1,b2,b3; cin >> a1 >> kon >> a2 >> kon >> a3; cin >> b1 >> kon >> b2 >> kon >> b3; if(a1 > b1 || (a1 == b1 && a2 > b2) || (a1 == b1 && a2 == b2 && a3 >= b3)){ cout << "YES" << endl; }else{ cout << "NO" << endl; } return 0; }