I believe I have solved the first part of the problem. I.e. I have a set of T triplets that satisfy the conditions 1-4.

However, I am a bit confused by the second part:

Should there be a

and

that satisfies this for every

? Or is it sufficient if it is satisfied for one

? The problem specification isn't so clear about this, or am I missing something? I haven't checked my solution in detail yet, but currently, my intuition is that there isn't a pair of

and

that satisfies it for all k in my solution.