added ternary exercise