d = gets.split.map(&:to_i).sort a = [[0,1,1,3,3,5,6], [0,1,1,3,4,5,6], [0,1,2,3,3,5,6], [0,1,2,3,4,5,6]] if a.include?(d.map{|x|d.index(x)}) puts "YES" else puts "NO" end