n,*k=$<.read.split.map &:to_i f=->(a,x){ [*0...a.size].combination(3).send([:any?,:select][x]){|i,j,k| a[i]!=a[k]&&((a[i]-a[j])*(a[j]-a[k])<0)&&(b=a.dup;[k,j,i].map{|e|b.delete_at e};!f[b,0]) } } puts (f[k,1][0]||[-1])*' '