Problem: Let $n \ge 4$ be an integer.
Find all functions $W \colon \{1, \dots, n\}^2 \to \RR$ such that
for every partition $[n] = A \cup B \cup C$ into disjoint sets,
\[ \sum_{a \in A} \sum_{b \in B} \sum_{c \in C} W(a,b) W(b,c)
= |A| |B| |C|. \]

Solution: Of course, $W(k,k)$ is arbitrary for $k \in [n]$.
We claim that $W(a,b) = \pm 1$ for any $a \neq b$, with the sign fixed.
(These evidently work.)

First, let $X_{abc} = W(a,b)W(b,c)$ for all distinct $a$, $b$, $c$,
so the given condition is
\[ \sum_{a,b,c \in A \times B \times C} X_{abc} = |A| |B| |C|. \]
Consider the given equation with the particular choices
\begin{itemize}
  \ii $A = \{1\}$, $B = \{2\}$, $C = \{3,4,\dots,n\}$.
  \ii $A = \{1\}$, $B = \{3\}$, $C = \{2,4,\dots,n\}$.
  \ii $A = \{1\}$, $B = \{2,3\}$, $C = \{4,\dots,n\}$.
\end{itemize}
This gives
\begin{align*}
  X_{123} + X_{124} + \dots + X_{12n} &= n-2 \\
  X_{132} + X_{134} + \dots + X_{13n} &= n-2 \\
  (X_{124} + \dots + X_{12n})
  + (X_{134} + \dots + X_{13n}) &= 2(n-3).
\end{align*}
Adding the first two and
subtracting the last one gives $X_{123} + X_{132} = 2$.
Similarly, $X_{123} + X_{321} = 2$,
and in this way we have $X_{321} = X_{132}$.
Thus $W(3,2)W(2,1) = W(1,3)W(3,2)$,
and since $W(3,2) \neq 0$ (clearly) we get $W(2,1) = W(3,2)$.

Analogously, for any distinct $a$, $b$, $c$ we have $W(a,b) = W(b,c)$.
For $n \ge 4$ this is enough to imply $W(a,b) = \pm 1$ for $a \neq b$
where the choice of sign is the same for all $a$ and $b$.

\begin{remark*}
Surprisingly, the $n = 3$ case has ``extra'' solutions for
$W(1,2) = W(2,3) = W(3,1) = \pm1$,
$W(2,1) = W(3,2) = W(1,3) = \mp1$.
\end{remark*}
\begin{remark*}
[Intuition]
It should still be possible to solve the problem
with $X_{abc}$ in place of $W(a,b) W(b,c)$,
because we have about far more equations than variables $X_{a,b,c}$
so linear algebra assures us we almost certainly have a unique solution.
\end{remark*}