You can see one method on the Internet:
In three groups: A1, A2, A3, A4; B1, B2, B3, B4; C1, C2, C3, C4;
Switch (comparison (a1a2a3a4, b1b2b3b4) // The first comparison
{
Case =:
Swicth (comparison (C1, C2) // second comparison
{
Case>:
If (C1> C3) return C1 (heavier); // The third comparison
Else if (C1 = C3) return C2 (lighter );
// C1 <C3 is not possible
Break;
Case <:
If (C1 <C3) return C1 (lighter); // The third comparison
Else if (C1 = C3) return C2 (heavier );
// C1> C3 is not possible
Break;
Case =:
If (C1 = C3) return C4; // The third comparison
Else if (C1> C3) return C3 (lighter );
Else if (C1 <C3) return C3 (heavier );
Break;
}
Break;
Case>:/* This indicates that c1c2c3c4 is normal */
Switch (comparison (a1c2c3c4, b1a2a3a4) // second comparison
{
Case>:/* description in A1 and B1 */
If (a1b1> c1c2) return A1 (heavy); // The third comparison
Else if (a1b1 <c1c2) return B1 (light );
// A1b1 = c1c2 is not possible
Break;
Case <:/* indicates that the request is in A2, A3, and A4, and is heavier */
If (A3> A2) return A3 (heavy); // The third comparison
Else if (A3 <A2) return A2 (heavy );
Else if (A3 = a2) return A4 (heavy );
Break;
Case =:/* indicates that the request is in B2, B3, B4, and is lighter */
If (B3> B2) return B2 (light); // The third comparison
Else if (B3 <B2) return B3 (light );
Else if (B3 = b2) return B4 (light );
Break;
}
Break;
Case <:
The operation can be inferred by> symmetry.
Break;
}