#include using namespace std; int main(void) { int s[2]; for (int i = 0; i < 2; i++) { int a, b, c; char ch; cin >> a >> ch >> b >> ch >> c; s[i] = a * 1000000 + b * 1000 + c; } cout << (s[1] <= s[0] ? "YES" : "NO") << endl; return 0; }