Yes:=false; for i:=1 to N do begin b:=a[1,i]; for j:=2 to N do if b<a[i,j] then b:=a[i,j]; Yes:=Yes or (k=b) end;