How to write the Kirchoff's voltage equations for this complex circuit?
There's actually a really straightforward way to approach this, if you don't mind using a matrix calculation (Matlab, for example).

In the traditional circuit analysis, the unknown variable is a vector of voltages corresponding to the ports.  Choose one of the ports as a reference, I'll use the bottom one since that's where we usually put ground on schematics)

$$\mathbf{x} = \left[ \begin{array}{c} x_1 \\ x_2 \\ x_3 \\ x_4 \end{array} \right] = \left[ \begin{array}{c} V_{15} \\ V_{25} \\ V_{35} \\ V_{45} \end{array} \right]$$

For each port you either have a trivial voltage equation setting that port voltage to the applied input, or a conservation of current equation (net current out of a disconnected port is zero).

For excitation connected to ports 1 and 2, the trivial equation is

$$x_1 - x_2 = V_{input}$$

and the KCL equations are (using conductance G which is the reciprocal of resistance R)

(port 3) $$G_2 (x_3-x_1) + G_5 (x_3-x_2) + G_8 (x_3-x_4) + G_9(x_3) = 0 $$
(port 4) $$G_3 (x_4-x_1) + G_6 (x_4-x_2) + G_8 (x_4-x_3) + G_{10}(x_4) = 0 $$
(port 5) $$G_4 (-x_1) + G_7 (-x_2) + G_9 (-x_3) + G_{10}(-x_4) = 0 $$

Because there is one equation for each port and one unknown for each port, you immediately have a system of linear equations.  As long as this system isn't degenerate (which it never is with the fully-connected graph of resistors, if all resistor values are finite) there will be a unique solution.

$$\left[ \begin{array}{c c c c} 1 &amp; -1 &amp; -0 &amp; 0 \\ -G_2 &amp; -G_5 &amp; G_2+G_5+G_8+G_9 &amp; -G_8 \\ -G_3 &amp; -G_6 &amp; -G_8 &amp; G_3+G_6+G_8+G_{10} \\ -G_4 &amp; -G_7 &amp; -G_9 &amp; -G_{10} \end{array} \right] \mathbf{x} = \left[ \begin{array}{c} V_{input} \\ 0 \\ 0 \\ 0 \end{array} \right]$$

A simple matrix inversion, which is easily automated, yields all the port voltages in terms of the resistances.

Unlike the traditional analysis, you want the resistances, so we'll organize the matrix multiply the other way, and also include the excitation current:

$$G_1 (x_1-x_2) + G_2 (x_1-x_3) + G_3 (x_1 - x_4) + G_4 (x_1) = i_{exc}$$

$$\left[ \begin{array}{c c c c c c c c c c} x_1-x_2 &amp; x_1-x_3 &amp; x_1-x_4 &amp; x_1 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 \\ 0 &amp; x_3-x_1 &amp; 0 &amp; 0 &amp; x_3-x_1 &amp; 0 &amp; 0 &amp; x_3-x_4 &amp; x_3 &amp; 0 \\ 0 &amp; 0 &amp; x_4-x_1 &amp; 0 &amp; 0 &amp; x_4-x_2 &amp; 0 &amp; x_4-x_3 &amp; 0 &amp; x_4 \\ 0 &amp; 0 &amp; 0 &amp; -x_1 &amp; 0 &amp; 0 &amp; -x_2 &amp; 0 &amp; -x_3 &amp; -x_4 \end{array} \right] \left[ \begin{array}{c} G_1 \\ G_2 \\ G_3 \\ G_4 \\ G_5 \\ G_6 \\ G_7 \\ G_8 \\ G_9 \\ G_{10} \end{array} \right] = \left[ \begin{array}{c} i_{exc} \\ 0 \\ 0 \\ 0 \end{array} \right]$$

Now you'll have to take all of those results together and get your conductances, which lead easily to resistances.

Let's calculate the size of that final step.  There are (k choose 2) total resistances, and you have (k choose 2) ways to energize the system, with (k-2) intermediate voltage measurements from each.  Plus one measurement of energizing current for each, if you choose to use it.  That's (k-1)*(k choose 2) equations, which should be plenty for solving (k choose 2) unknown resistances.  The system will be overconstrained, but you'll have some measurement error, so a pseudo-inverse will give the set of resistances that is most consistent (in a least-squares error sense) with your measurements.

You can presumably get away with just using the equation for input current for each of the (k choose 2) excitation patterns, and have enough equations, but without redundancy any measurement inaccuracy can lead to a big discrepancy in the end... the redundant equations help protect against that.

The key to a systematic approach is to not write loop equations at all, let the matrix algebra system derive them automatically.