Modifies a specified element of an array of arrays arr with the provided val. Require that no two array references are equal. Ensure other elements remain unchanged.