Gildong owns a bulgogi restaurant. The restaurant has a lot of customers, so many of them like to make a reservation before visiting it.

Gildong tries so hard to satisfy the customers that he even memorized all customers' preferred temperature ranges! Looking through the reservation list, he wants to satisfy all customers by controlling the temperature of the restaurant.

The restaurant has an air conditioner that has 3 states: off, heating, and cooling. When it's off, the restaurant's temperature remains the same. When it's heating, the temperature increases by 1 in one minute. Lastly, when it's cooling, the temperature decreases by 1 in one minute. Gildong can change the state as many times as he wants, at any integer minutes. The air conditioner is off initially.

Each customer is characterized by three values: $t_i$ — the time (in minutes) when the $i$-th customer visits the restaurant, $l_i$ — the lower bound of their preferred temperature range, and $h_i$ — the upper bound of their preferred temperature range.

A customer is satisfied if the temperature is within the preferred range at the instant they visit the restaurant. Formally, the $i$-th customer is satisfied if and only if the temperature is between $l_i$ and $h_i$ (inclusive) in the $t_i$-th minute.

Given the initial temperature, the list of reserved customers' visit times and their preferred temperature ranges, you're going to help him find if it's possible to satisfy all customers.


-----Input-----

Each test contains one or more test cases. The first line contains the number of test cases $q$ ($1 \le q \le 500$). Description of the test cases follows.

The first line of each test case contains two integers $n$ and $m$ ($1 \le n \le 100$, $-10^9 \le m \le 10^9$), where $n$ is the number of reserved customers and $m$ is the initial temperature of the restaurant.

Next, $n$ lines follow. The $i$-th line of them contains three integers $t_i$, $l_i$, and $h_i$ ($1 \le t_i \le 10^9$, $-10^9 \le l_i \le h_i \le 10^9$), where $t_i$ is the time when the $i$-th customer visits, $l_i$ is the lower bound of their preferred temperature range, and $h_i$ is the upper bound of their preferred temperature range. The preferred temperature ranges are inclusive.

The customers are given in non-decreasing order of their visit time, and the current time is $0$.


-----Output-----

For each test case, print "YES" if it is possible to satisfy all customers. Otherwise, print "NO".

You can print each letter in any case (upper or lower).


-----Example-----
Input
4
3 0
5 1 2
7 3 5
10 -1 0
2 12
5 7 10
10 16 20
3 -100
100 0 0
100 -50 50
200 100 100
1 100
99 -100 0

Output
YES
NO
YES
NO



-----Note-----

In the first case, Gildong can control the air conditioner to satisfy all customers in the following way:  At $0$-th minute, change the state to heating (the temperature is 0).  At $2$-nd minute, change the state to off (the temperature is 2).  At $5$-th minute, change the state to heating (the temperature is 2, the $1$-st customer is satisfied).  At $6$-th minute, change the state to off (the temperature is 3).  At $7$-th minute, change the state to cooling (the temperature is 3, the $2$-nd customer is satisfied).  At $10$-th minute, the temperature will be 0, which satisfies the last customer. 

In the third case, Gildong can change the state to heating at $0$-th minute and leave it be. Then all customers will be satisfied. Note that the $1$-st customer's visit time equals the $2$-nd customer's visit time.

In the second and the fourth case, Gildong has to make at least one customer unsatisfied.

Difficulty: interview

Starter code:

Solutions:
q = int(input())
for _ in range(q):
    n, m = list(map(int, input().split()))
    info = [list(map(int, input().split())) for i in range(n)]
    info = sorted(info)
    now =(m, m)
    time = 0
    flag = True
    for i in range(n):
        t, l, h = info[i]
        l_now = now[0] - (t - time)
        h_now = now[1] + (t - time)
        time = t
        if h < l_now or h_now < l:
            flag = False
        else:
            l_now = max(l_now, l)
            h_now = min(h_now, h)
            now = (l_now, h_now)
    if flag:
        print("YES")
    else:
        print("NO")

for _ in range(int(input())):
	n,m=map(int,input().split())
	lm=hm=m
	pt=0
	ans="YES"
	for i in range(n):
		t,l,h=map(int,input().split())
		lm-=(t-pt)
		hm+=(t-pt)
		pt=t
		hm=min(h,hm)
		lm=max(l,lm)
		if hm<lm:
			ans="NO"
	print(ans)

for _ in range(int(input())):
    n, m = list(map(int, input().split()))
    ar = [[0, -10 ** 9, 10 ** 9]]
    for ______ in range(n):
        ar.append(list(map(int, input().split())))
    ar.sort()
    left, right = m, m
    ans = 'YES'
    for i in range(1, n + 1):
        left -= ar[i][0] - ar[i - 1][0]
        right += ar[i][0] - ar[i - 1][0]
        left, right = [max(left, ar[i][1]), min(right, ar[i][2])]
        if right - left < 0:
            ans = 'NO'
    print(ans)

import sys
input = sys.stdin.readline

T = int(input())
for _ in range(T):
    n, m = map(int, input().split())
    CUS = [tuple(map(int, input().split())) for _ in range(n)]
    CUS.sort()
    L = m
    R = m
    prv = 0
    ans = True
    for t, l, r in CUS:
        d = t - prv
        L -= d
        R += d
        if R < l or r < L:
            ans = False
            break
        else:
            R = min(R, r)
            L = max(L, l)
            prv = t
    if ans:
        print("YES")
    else:
        print("NO")

def solve():
    n, m = list(map(int, input().split()))
    cust = []
    for ___ in range(n):
        t, l, h = list(map(int, input().split()))
        cust.append((t, l, h))

    cust.sort()

    lastT = 0
    lastMaxT = m
    lastMinT = m

    for t, l, h in cust:
        nextMax = lastMaxT + t - lastT
        nextMin = lastMinT - t + lastT

        if nextMax < l or nextMin > h:
            print("NO")
            return

        lastMaxT = min(h, nextMax)
        lastMinT = max(l, nextMin)
        lastT = t
    print("YES")


q = int(input())
for __ in range(q):
    solve()


for t in range(int(input())):
    n, m = list(map(int, input().split()))
    a = []
    for i in range(n):
        a.append(list(map(int, input().split())))
    t0 = 0
    mi, ma = m, m
    f = True
    for t, l, h in a:
        delta = t - t0
        t0 = t
        mi -= delta
        ma += delta
        if mi <= l and ma >= h:
            mi = l
            ma = h
        elif l <= ma <= h and mi <= l:
            mi = l
            ma = ma
        elif l <= ma <= h and l <= mi <= h:
            mi = mi
            ma = ma
        elif ma >= h and l <= mi <= h:
            ma = h
            mi = mi
        else:
            f = False
    if f:
        print("YES")
    else:
        print("NO")


T = int(input())

for _ in range(T):
    n, m = list(map(int, input().split()))
    time, mx, mn = 0, m, m
    flag = True

    for __ in range(n):
        x, y, z = list(map(int, input().split()))

        if not flag:
            continue

        mx += x - time
        mn -= x - time

        if mx < y or mn > z:
            flag = False

        if mx > z:
            mx = z

        if mn < y:
            mn = y

        time = x

    print('YES' if flag else 'NO')


def getIntersect(a, b, c, d):
    return (max(a, c), min(b, d))


def solve(N, M, A):
    tHi = M
    tLo = M
    A.sort()
    lastT = 0
    for t, l, h in A:
        deltaT = t - lastT
        tLo -= deltaT
        tHi += deltaT
        tLo, tHi = getIntersect(tLo, tHi, l, h)
        if tLo > tHi:
            return "NO"
        lastT = t
    return "YES"


def __starting_point():
    T, = list(map(int, input().split()))
    for t in range(T):
        N, M = list(map(int, input().split()))
        A = []
        for i in range(N):
            tlh = [int(x) for x in input().split()]
            A.append(tlh)

        ans = solve(N, M, A)
        print(ans)

__starting_point()

Q = int(input())

for _ in range(Q):
    n, m = map(int, input().split())
    lt, mn, mx = 0, m, m
    ok = True
    for i in range(n):
        if ok:
            t, l, h = map(int, input().split())
            mn = max(mn - (t - lt), l)
            mx = min(mx + (t - lt), h)
            lt = t
            if mn>mx:
                ok=False

        else:
            input()
    print('YES' if ok else 'NO')

q = int(input())
for rewrew in range(q):
	n, t0 = map(int,input().split())
	t = []
	l = []
	h = []
	for i in range(n):
		tt,ll,hh = map(int,input().split())
		t.append(tt)
		l.append(ll)
		h.append(hh)
	possib = [[0,0]]*n
	dasie = True
	possib[0] = [-t[0]+t0,t[0]+t0]
	for i in range(n):
		if l[i]>possib[i][1] or h[i] < possib[i][0]:
			dasie = False
			break
		else:
			possib[i][0] = max(possib[i][0],l[i])
			possib[i][1] = min(possib[i][1], h[i])
		if i < n-1:
			possib[i+1][0] = possib[i][0] - (t[i+1]-t[i])
			possib[i+1][1] = possib[i][1] + (t[i+1]-t[i])
	if dasie:
		print("YES")
	else:
		print("NO")

from collections import defaultdict


def problemA():
    t = int(input())
    for _ in range(t):
        x, y, a, b = list(map(int, input().split()))

        if (y - x) % (a + b) == 0:
            print((y - x) // (a + b))
        else:
            print(-1)


def problemB():
    n, m = list(map(int, input().split()))
    ss = set()
    res = []

    for i in range(n):
        s = input()
        rs = s[::-1]
        if rs in ss:
            res.append(s)
            ss.remove(rs)
        else:
            ss.add(s)

    long = ''
    for s in ss:
        if s == s[::-1] and len(s) > len(int):
            long = s

    res = ''.join(res)
    res = res + int + res[::-1]
    print(len(res))
    print(res)


def problemC():
    inf = 2 * 10 ** 9

    q = int(input())
    for _ in range(q):
        n, m = list(map(int, input().split()))

        a = defaultdict(lambda: (-inf, inf))
        for _ in range(n):
            t, l, h = list(map(int, input().split()))
            pl, ph = a[t]
            a[t] = (max(l, pl), min(h, ph))

        pt = 0
        pl, ph = m, m
        res = 'YES'
        for t in sorted(a.keys()):
            l, h = a[t]

            delta = t - pt
            cl = pl - delta
            ch = ph + delta

            pl = max(l, cl)
            ph = min(h, ch)

            if pl > ph:
                res = 'NO'
                break

            pt = t

        print(res)


def problemG():
    t = int(input())
    for _ in range(t):
        n = int(input())
        a = list(map(int, input().split()))

        res = 0
        print(a)


def __starting_point():
    problemC()

__starting_point()

q = int(input())
for _ in range(q):
    n,m = list(map(int, input().split()))
    customers = [[int(x) for x in input().split()] for _ in range(n)]

    now_l, now_h = m, m
    now = 0
    for t,l,h in customers:
        dt = t - now

        # in area?
        next_h = min(now_h + dt, h)
        next_l = max(now_l - dt, l)
        if not next_l <= next_h:
            ok = False
            break

        now = t
        now_l, now_h = next_l, next_h
    else:
        ok = True

    print("YES" if ok else "NO")


import sys
input = sys.stdin.readline

Q = int(input())
Query = []
for _ in range(Q):
    N, M = map(int, input().split())
    TLR = [list(map(int, input().split())) for _ in range(N)]
    Query.append((N, M, TLR))


for N, M, TLR in Query:
    TLR.sort()
    large = M
    small = M
    pret = 0
    ok = True
    for t, l, r in TLR:
        delta = t - pret
        large += delta
        small -= delta

        if large < l or r < small:
            ok = False
            break
        large = min(large, r)
        small = max(small, l)

        pret = t
    
    print("YES" if ok else "NO")