Characterization of optimal decompositions in real interpolation