Products and coproducts of groups