Classes of products of M-matrices and inverse M-matrices