puts'001123345024250360405131416'.index(gets.split.map{|e|e.to_i.abs}.minmax*'')?:YES: :NO