For 12:
Weigh 1,2,3,4 against 5,6,7,8
If they balance then one of 9,10,11,12 is odd.
Weigh 1,2,3 against 9,10,11.
If they balance then 12 is odd. Weigh against 1 to find if it's heavy or light.
If they don't balance then let's suppose 9,10,11 is heavier (a similar argument can be used if it's lighter). Weigh 9 against 10. If they balance then you know 11 is heavy. If they don't then the heavier one is the odd ball.
If 1,2,3,4 against 5,6,7,8 doesn't balance then suppose 1,2,3,4 is heavier (if 5,6,7,8 is heavy then switch the labels around).
Weigh 1,2,5 against 3,6,9
If they balance then either 4 is heavy or 7 is light or 8 is light. Weigh 7 against 8. If they balance then 4 is heavy. If they don't then the lighter one is the odd ball.
If 1,2,5 against 3,6,9 doesn't balance consider two cases:
1,2,5 is heavier than 3,6,9:
Either 1 is heavy or 2 is heavy or 6 is light. Weigh 1 against 2 to determine the odd ball and its weight.
1,2,5 is lighter than 3,6,9:
Either 5 is light or 3 is heavy. Weigh 5 against 12. If it balances then 3 is heavy. If it doesn't then 5 is light.