In order for it to be possible for a triangle to be formed with the following side lengths, the sum of two of the side lengths must be longer than the other side length.
Let's test every possible set of side lengths and see if each of the sum is greater than the last side.
240 + 123 > 166
363 > 166
240 + 166 > 123
406 > 123
166 + 123 > 240
289 > 240
Since the sum of any 2 sides is always greater than the other side, a triangle can be formed using those side lengths.
Have an awesome day! :)