#include <stdio.h>

int main ( void ) {
	int verA[3] , verB[3];


	scanf ( "%d.%d.%d" , verA , verA + 1 , verA + 2 );
	scanf ( "%d.%d.%d" , verB , verB + 1 , verB + 2 );

	int verA_Once = verA [ 0 ] * 1000 * 1000 + verA [ 1 ] * 1000 + verA [ 2 ];
	int verB_Once = verB [ 0 ] * 1000 * 1000 + verB [ 1 ] * 1000 + verB [ 2 ];

	
	printf ( "%s\n" , ( verA_Once > verB_Once ) ? "YES"  : "NO" );

	return 0;
}