gets i=0 a=$<.map{|e,i|a,b=e.split.map &:to_i [a-30000*b,i+=1]}.max puts a[0]<500000?:NO:[:YES]+[a[1]]*6