Representations for (1)- and (1,2)-inverses for partitioned matrices