#define _GLIBCXX_DEBUG #include using namespace std; int main() { string S, T; cin >> S >> T; if(S == T) cout << "YES" << endl; else{ int s = stoi(S.substr(0,1)); int t = stoi(T.substr(0,1)); if(s != t){ if(s < t) cout << "NO" << endl; else cout << "YES" << endl; }else{ s = stoi(S.substr(2,3)); t = stoi(T.substr(2,3)); if(s != t){ if(s < t) cout << "NO" << endl; else cout << "YES" << endl; }else{ s = stoi(S.substr(4,5)); t = stoi(T.substr(4,5)); if(s < t) cout << "NO" << endl; else cout << "YES" << endl; } } } }