a,b = 2.times.map{gets.split(?.).map &:to_i} puts (a[0] <=> b[0]) * 9 + (a[1] <=> b[1]) * 3 + (a[2] <=> b[2]) < 0 ? :NO : :YES