f = Array.new(gets.chomp.split(".").map &:to_i) v = Array.new(gets.chomp.split(".").map &:to_i) pr = proc{|a| a[0]*1000000+a[1]*1000+a[2]} puts pr.(f)>=pr.(v) ? "YES" : "NO"