Dejar
$$\mathrm B := \begin{bmatrix} -a & 1-a\\ 1-a & -a\end{bmatrix}$$
whose inverse is
$$\mathrm B^{-1} = \frac{1}{1-2a} \begin{bmatrix} a & 1-a\\ 1-a & a\end{bmatrix}$$
We would like to compute the inverse of
$$\mathrm M := a 1_6 1_6^\top + (\mathrm I_3 \otimes \mathrm B)$$
where $ \ otimes$ denotes the Kronecker product. Using Sherman-Morrison,
$$\mathrm M^{-1} = \left( \mathrm I_3 \otimes \mathrm B^{-1} \right) - \frac{\left( \mathrm I_3 \otimes \mathrm B^{-1} \right) a 1_6 1_6^\top \left( \mathrm I_3 \otimes \mathrm B^{-1} \right)}{1 + a 1_6^\top \left( \mathrm I_3 \otimes \mathrm B^{-1} \right) 1_6}$$
where
$$\left( \mathrm I_3 \otimes \mathrm B^{-1} \right) 1_6 = \left( \mathrm I_3 \otimes \mathrm B^{-1} \right) \left( 1_3 \otimes 1_2 \right) = 1_3 \otimes \left( \mathrm B^{-1} 1_2\right) = \left( \frac{1}{1-2a} \right) 1_6$$
and
$$1_6^\top \left( \mathrm I_3 \otimes \mathrm B^{-1} \right) = \left( \left( \mathrm I_3 \otimes \mathrm B^{-\top} \right) 1_6 \right)^\top = \left( \left( \mathrm I_3 \otimes \mathrm B^{-1} \right) 1_6 \right)^\top = \left( \frac{1}{1-2a} \right) 1_6^\top$$
Hence,
$$\begin{aligned} \mathrm M^{-1} &= \left( \mathrm I_3 \otimes \mathrm B^{-1} \right) - \frac{1}{(1- 2 a)^2} \left(\frac{a}{1 + \left( \frac{6a}{1-2a} \right)}\right) 1_6 1_6^\top \\ &= \left( \mathrm I_3 \otimes \mathrm B^{-1} \right) - \frac{a}{(1 - 2 a) (1 + 4 a)} 1_6 1_6^\top \end{aligned}$$
Using SymPy:
>>> from sympy import *
>>> a = Symbol('a', real=True, positive=True)
>>> M = Matrix([[0,1,a,a,a,a],
[1,0,a,a,a,a],
[a,a,0,1,a,a],
[a,a,1,0,a,a],
[a,a,a,a,0,1],
[a,a,a,a,1,0]])
>>> B = Matrix([[ -a,1-a],
[1-a, -a]])
>>> M_inv = TensorProduct(eye(3), B**-1) - (a / ((1+4*a) * (1-2*a))) * ones(6,6)
Verifying if the inverse was computed correctly:
>>> simplify(M * M_inv)
Matrix([
[1, 0, 0, 0, 0, 0],
[0, 1, 0, 0, 0, 0],
[0, 0, 1, 0, 0, 0],
[0, 0, 0, 1, 0, 0],
[0, 0, 0, 0, 1, 0],
[0, 0, 0, 0, 0, 1]])
Indeed, it was. Factoring out $ 1 - 2 a$ and $ 1 + 4 a$:
>>> simplify((1-2*a) * (1+4*a) * M_inv)
Matrix([
[ 4*a**2, -a - (a - 1)*(4*a + 1), -a, -a, -a, -a],
[-a - (a - 1)*(4*a + 1), 4*a**2, -a, -a, -a, -a],
[ -a, -a, 4*a**2, -a - (a - 1)*(4*a + 1), -a, -a],
[ -a, -a, -a - (a - 1)*(4*a + 1), 4*a**2, -a, -a],
[ -a, -a, -a, -a, 4*a**2, -a - (a - 1)*(4*a + 1)],
[ -a, -a, -a, -a, -a - (a - 1)*(4*a + 1), 4*a**2]])
Hence,
$$\mathrm M^{-1} = \frac{1}{(1 - 2 a) (1 + 4 a)} \begin{bmatrix} 4 a^{2} & g (a) & - a & - a & - a & - a\\ g (a) & 4 a^{2} & - a & - a & - a & - a\\- a & - a & 4 a^{2} & g (a) & - a & - a\\- a & - a & g (a) & 4 a^{2} & - a & - a\\- a & - a & - a & - a & 4 a^{2} & g (a)\\- a & - a & - a & - a & g (a) & 4 a^{2}\end{bmatrix}$ PS