a,b=$<.map{|e|e.split(?.).map &:to_i};f=->c{c[0]*10**6+c[1]*1000+c[2]};puts f[a]>f[b] ?:YES:'NO'