First a bit more on the ternary solution. It is called a ternary or base-3 problem because you have three possible outcomes for each weighing. Since there are three weighings, this gives 3x3x3=27 possibilities. While not explicitly mentioned in gabi's solution, the key is to make sure that any given statue is not weighed three times on the same side of the scale. This eliminates the possibilities of UUU, DDD, and MMM (in which case there was no odd statue to begin with). That reduces the possibilities to 24. You will also notice that keeping M fixed, there are only tweleve unique combinations if we allow for U<->D permutations. The rest was explained by gabi.

Now, the other way to attack the problem is with conditional weighings, and this method is complicated to remember and represent. But here goes nothing.

Code:

First let's represent the statues by numbering them 1-12.
First weighing: Compare {1,2,3,4} and {5,6,7,8}.
*If {1,2,3,4} equals {5,6,7,8}, then the odd statue is in the group {9,10,11,12}.
Any of the group {1,2,3,4,5,6,7,8} is a regular statue, so let's pick {1} as
the representative. For the second weighing, compare {1,9} and {10,11}.
**If {1,9} equals {10,11}, then {12} is the odd statue. For the third
weighing, compare {1} to {12} to determine if {12} is heavy or light.
**Else if {1,9} does not equal {10,11} then {12} is a regular statue. For
the third weighing, compare {10} and {11}.
***If {10} equals {11} then {9} is the odd statue. Use the result
of the second weighing to determine if {9} is heavy or light.
***Else either {10} or {11} is the odd statue. If {1,9} < {10,11},
then the odd statue is the heavier one of {10} and {11}, and
if {1,9} > {10,11}, then the odd statue is the lighter one of
{10} and {11}.
*Else if {1,2,3,4} does not equal {5,6,7,8}, then {9,10,11,12} are regular statues;
let's pick {9} as their representative. The results from the first weighing
show if the odd statue is heavy or light. For the second weighing, compare
{1,2,5} to {3,6,9}.
**If {1,2,5} is equal to {3,6,9} then the odd statue is one of {4,7,8}.
For the third weighing, compare {7} to {8}.
***If {7} is equal to {8}, then {4} is the odd statue. Use first
weighing to determine if {4} is heavy or light.
***Else if {7} is not equal to {8}, then if {1,2,3,4} < {5,6,7,8}, the
odd statue is the heavier of {7} and {8}, and if
{1,2,3,4} > {5,6,7,8}, then the odd statue is the lighter of
{7} and {8}.
**Else if {1,2,5} is not equal to {3,6,9}, then the odd statue is one of
{1,2,3,5,6}.
***If {1,2,3,4} < {5,6,7,8} and {1,2,5} < {3,6,9} then either one of
{1,2} is light or {6} is heavy. In the third weighing, compare
{1} and {2}. If {1} and {2} are equal, then the odd one is a
heavy {6}, otherwise the odd one is the lighter of {1} and {2}.
***Else if {1,2,3,4} < {5,6,7,8} and {1,2,5} > {3,6,9} then either {3}
is light or {5} is heavy. In the third weighing, compare {3} to
{9}. If {3} is equal to {9}, then the odd statue is a heavy {5},
otherwise the odd statue is a light {3}.
***Else if {1,2,3,4} > {5,6,7,8} and {1,2,5} < {3,6,9} then either {5}
is light or {3} is heavy. In the third weighing, compare {3} to
{9}. If {3} is equal to {9}, then the odd statue is a light {5},
otherwise the odd statue is a heavy {3}.
***Else if {1,2,3,4} > {5,6,7,8} and {1,2,5} > {3,6,9} then either {6}
is light and one of {1,2} is heavy. In the third weighing, compare
{1} and {2}. If {1} and {2} are equal, then the odd one is a light
{6}, otherwise the odd one is the heavier of {1} and {2}.

## Bookmarks