Olgierd, the hero of this problem, is a high-school student just like you. He practices on various online judges, hoping to reach the finals of the Polish Olympiad in Informatics.
His next step is the Funny Informatics Contest (ŚKI). The contest is made up of many rounds whose time spans may overlap one another arbitrarily. Each round comes with exactly one problem.
Olgierd does not know the problems yet, but he has already decided how much time to spend on each round. Once he starts a problem, he works on it without any break for exactly the time he planned (caffeine helps). The rules are:
Because the ŚKI problems are very hard, the time Olgierd plans for each round is at least half of that round's total length.
Determine whether he can spend exactly the planned amount of time on every round.
Formally, there are n rounds. Round i takes place inside the time interval [ai,bi]. Olgierd wants to spend a continuous block of length ci on it, and this block must lie entirely within [ai,bi]. Blocks of different rounds may not overlap in time (touching at an endpoint is allowed). For every round it is guaranteed that 2bi−ai≤ci. Decide whether such a non-overlapping assignment exists.
The first line contains the number of data sets (test cases) z.
The first line of each data set contains the number of rounds n (1≤n≤2⋅105). Each of the next n lines describes one round with three integers ai, bi, ci (0≤ai<bi≤109, 2bi−ai≤ci≤bi−ai): round i starts at time ai, ends at time bi, and Olgierd wants to spend ci units of time on it. The sum of n over all data sets does not exceed 106.
For each data set output a single line: TAK if Olgierd can carry out his plan, or NIE if it is impossible. (TAK means "yes" and NIE means "no".)