$\operatorname{lcm}(\operatorname{gcd}(a,b),c)=\operatorname{gcd}(\operatorname{lcm}(a,c),\operatorname{lcm}(b,c))$ for any $a,b,c \in \mathbb{Z}$

I tried to show that the lattice of subgroups of the group $\mathbb{Z}$ is distributive. The question reduced showing that for any $a,b,c \in \mathbb{Z}$ we have that

$$\operatorname{lcm}(\operatorname{gcd}(a,b),c) = \operatorname{gcd}(\operatorname{lcm}(a,c),\operatorname{lcm}(b,c)).$$

But I couldn't show this equality. Thanks for your help.

Using prime factor decompositions and remembering $$\mathrm{lcm}(p^a,p^b)=p^{\max(a,b)}$$, $$\mathrm{gcd}(p^a,p^b)=p^{\min(a,b)}$$ for primes $$p$$, one reduces the claim to the equation
$$\max(\min(a,b),c) = \min(\max(a,c),\max(b,c))$$
for $$a,b,c \in \mathbb{N}$$. We have $$a \leq b$$ or $$b \leq a$$. By symmetry, we may assume $$a \leq b$$. Then the LHS is $$\max(a,c)$$, and the RHS also equals $$\max(a,c)$$ since $$\max(a,c) \leq \max(b,c)$$.
So actually the equation above holds in every linear order. The crux is that although $$(\mathbb{N} \setminus \{0\},|)$$ is not a linear order, it embeds into a product of linear orders, using prime factor decompositions. More generally we see that the lattice of ideals of a PID is distributive (which fails for other rings).
Factor $a, b$ and $c$ and your equation into prime powers, and look at the resulting power of each prime.