Inverse problems for minimal complements and maximal supplements