#include using namespace std; int main() { char S[ 20 ]; char T[ 20 ]; cin >> S; cin >> T; do { if( S[ 0 ] < T[ 0 ] ) break; if( S[ 2 ] < T[ 2 ] ) break; if( S[ 4 ] < T[ 4 ] ) break; cout << "YES" << endl; return 0; } while( false ); cout << "NO" << endl; return 0; }