f=proc{|a,b,c|aa&&b>c))} puts gets.split.map(&:to_i).permutation.any?{|e|e.each_cons(3).all?(&f)}?:YES: :NO