a,b,c=gets.split('.').map(&:to_i) x,y,z=gets.split('.').map(&:to_i) puts x*1000000+y*1000+z<=a*1000000+b*1000+c ? "YES" : "NO"