Convert to ternaries