#include using namespace std; signed main(){ string ans[] = { "NO", "YES" }; vector< int > v1( 5 ), v2( 5 ); scanf( "%d.%d.%d", &v1[ 0 ], &v1[ 2 ], &v1[ 4 ] ); scanf( "%d.%d.%d", &v2[ 0 ], &v2[ 2 ], &v2[ 4 ] ); if( v1[ 0 ] != v2[ 0 ] ) cout << ans[ v2[ 0 ] <= v1[ 0 ] ] << endl; else if( v1[ 2 ] != v2[ 2 ] ) cout << ans[ v2[ 2 ] <= v1[ 2 ] ] << endl; else if( v1[ 4 ] != v2[ 4 ] ) cout << ans[ v2[ 4 ] <= v1[ 4 ] ] << endl; else cout << "YES" << endl; return 0; }