Find elements in matrix with both sorted rows and columns.