Let G be a finite group and let H_1,H_2, \ldots H_n be subgroups of G such that:
(a) G=H_1H_2 \ldots H_n but G \neq H_1H_2 \ldots H_{i-1}H_{i+1} \ldots H_n for all i
(b) The H_i have parewise trivial intersections.
(c) The orders of the H_i are prime numbers.
Show that |G| = |H_1||H_2| \ldots |H_n|.

I have tried induction. So, H_1\ldots H_{n+1} = HH_{n+1}, where H = H_1\ldots H_n. Now, if I could prove that H is a subgroup of G, it is trivial that H, H1, ..., Hn satisfy (a), (b), (c). Therefore, |H| = |H_1|\ldots |H_n|. Furthermore,
using |K_1K_2| = |K_1||K_2| / |K_1\cap  K_2|, if I could prove that H \cap H_{n+1} = (e), (but this I think I could prove it using the fact that H is a subgroup), I would have |G| = |H \ldots H_{n+1}| = |HH_{n+1}|=  |H||H_{n+1}| = |H_1|\ldots |H_n||H_{n+1}|.

But unfortunately, I cannot prove that H is a group. Any suggestion will be welcome. Thanks for reading.