# Your code here! kaseki = gets.split(".").map(&:to_i) current = gets.split(".").map(&:to_i) puts current[0]*10201+current[1]*101+current[2]<=kaseki[0]*10201+kaseki[1]*101+kaseki[2] ? "YES" : "NO"