coding ternary