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 ≤ q ≤ 500). Description of the test cases follows.

The first line of each test case contains two integers n and m (1 ≤ n ≤ 100, -10^9 ≤ m ≤ 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 ≤ t_i ≤ 10^9, -10^9 ≤ l_i ≤ h_i ≤ 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.
import java.util.*;
import java.io.*;

public class Main {
	public static long gcd(long n, long m){ if(m > n) return gcd(m,n); if(m == 0) return n; return gcd(m, n%m);}
	public static long lcm(long m, long n){ return (m/gcd(m,n))*n;}
	static int mod = 1000000007;
	static int INF = Integer.MAX_VALUE;
	static int[] dx = {0,0,1,-1};
	static int[] dy = {1,-1,0,0};
	static int[] dx8 = {0,0,1,-1,1,1,-1,-1};
	static int[] dy8 = {1,-1,0,0,1,-1,-1,1};
	public static void main(String[] args){
		FastScanner scanner = new FastScanner();
		int q = scanner.nextInt();
		while(q > 0){
			q--;
			int n = scanner.nextInt();
			int m = scanner.nextInt();
			int[] t = new int[n];
			int[] l = new int[n];
			int[] h = new int[n];
			for(int i = 0; i < n; i++){
				t[i] = scanner.nextInt();
				l[i] = scanner.nextInt();
				h[i] = scanner.nextInt();
			}
			int min = m;
			int max = m;
			boolean flag = true;
			int time = 0;
			for(int i = 0; i < n; i++){
				max += t[i]-time;
				min -= t[i]-time;
				if(max < l[i] || min > h[i]){
					flag = false;
					break;
				}
				max = Math.min(max,h[i]);
				min = Math.max(min,l[i]);
				time = t[i];
			}
			if(flag){
				System.out.println("YES");
			}else{
				System.out.println("NO");
			}
		}
	}
	static class People implements Comparable<People>{
		int t;
		int low;
		int high;
		People(int t, int low, int high){
			this.t = t;
			this.low = low;
			this.high = high;
		}
		public int compareTo(People p){
			return t-p.t;
		}
	}
	static class Pair2 implements Comparable<Pair2>{
		long first;
		long second;
		Pair2(long first, long second){
			this.first = first;
			this.second = second;
		}
		@Override
		public int compareTo(Pair2 p){
			return Long.valueOf(first).compareTo(Long.valueOf(p.first));
		}
	}
	static class Edge2 implements Comparable<Edge2>{
		int from;
		int to;
		double cost;
		Edge2(int from, int to, double cost){
			this.from = from;
			this.to = to;
			this.cost = cost;
		}
		public int compareTo(Edge2 e){
			return Double.compare(cost,e.cost);
		}
	}
	// tar の方が数字が大きいかどうか
	static boolean compare(String tar, String src) {
		if (src == null) return true;
		if (src.length() == tar.length()) {
			int len = tar.length();
			for (int i = 0; i < len; i++) {
				if (src.charAt(i) > tar.charAt(i)) {
					return false;
				} else if (src.charAt(i) < tar.charAt(i)) {
					return true;
				}
			}
			return tar.compareTo(src) > 0 ? true : false;
		} else if (src.length() < tar.length()) {
			return true;
		} else if (src.length() > tar.length()) {
			return false;
		}
		return false;
	}
	static class RMQ {
		private int size_, dat[];
		private int query_(int a, int b, int k, int l, int r) {
			if(r <= a || b <= l) return 2147483647;
			if(a <= l && r <= b) return dat[k];
			int lc = query_(a, b, 2 * k, l, (l + r) / 2);
			int rc = query_(a, b, 2 * k + 1, (l + r) / 2, r);
			return Math.min(lc, rc);
		}
		RMQ(int s) {
			for(size_ = 1; size_ < s;) size_ *= 2;
			dat = new int[size_ * 2];
			for(int i = 0; i < size_ * 2; i++) dat[i] = 2147483647;
		}
		public void update(int pos, int x) {
			pos += size_; dat[pos] = x;
			while(pos > 1) {
				pos /= 2;
				dat[pos] = Math.min(dat[2 * pos], dat[2 * pos + 1]);
			}
		}
		public int query(int l, int r) {
			return query_(l, r, 1, 0, size_);
		}
	}
	static int size = 2100000;
	static long[] fac = new long[size];
	static long[] finv = new long[size];
	static long[] inv = new long[size];
	//繰り返し二乗法
	public static long pow(long x, long n){
		long ans = 1;
		while(n > 0){
			if((n & 1) == 1){
				ans = ans * x;
				ans %= mod;
			}
			x = x * x % mod;
			n >>= 1;
		}
		return ans;
	}
	public static long div(long x, long y){
		return (x*pow(y, mod-2))%mod;
	}
	//fac, inv, finvテーブルの初期化、これ使う場合はinitComb()で初期化必要
	public static  void initComb(){
		fac[0] = finv[0] = inv[0] = fac[1] = finv[1] = inv[1] = 1;
		for (int i = 2; i < size; ++i) {
			fac[i] = fac[i - 1] * i % mod;
			inv[i] = mod - (mod / i) * inv[(int) (mod % i)] % mod;
			finv[i] = finv[i - 1] * inv[i] % mod;
		}
	}
	//nCk % mod
	public static long comb(int n, int k){
		return fac[n] * finv[k] % mod * finv[n - k] % mod;
	}
	//n! % mod
	public static long fact(int n){
		return fac[n];
	}
	//(n!)^-1 with % mod
	public static long finv(int n){
		return finv[n];
	}

	static class Pair implements Comparable<Pair>{
    int first, second;
    Pair(int a, int b){
        first = a;
        second = b;
    }
    @Override
    public boolean equals(Object o){
        if (this == o) return true;
        if (!(o instanceof Pair)) return false;
        Pair p = (Pair) o;
        return first == p.first && second == p.second;
    }
    @Override
    public int compareTo(Pair p){
        //return first == p.first ? second - p.second : first - p.first; //firstで昇順にソート
        //return (first == p.first ? second - p.second : first - p.first) * -1; //firstで降順にソート
        return second == p.second ? first - p.first : second - p.second;//secondで昇順にソート
        //return (second == p.second ? first - p.first : second - p.second)*-1;//secondで降順にソート
		    //return first * 1.0 / second > p.first * 1.0 / p.second ? 1 : -1; // first/secondの昇順にソート
		    //return first * 1.0 / second < p.first * 1.0 / p.second ? 1 : -1; // first/secondの降順にソート
				//return second * 1.0 / first > p.second * 1.0 / p.first ? 1 : -1; // second/firstの昇順にソート
		    //return second * 1.0 / first < p.second * 1.0 / p.first ? 1 : -1; // second/firstの降順にソート
				//return Math.atan2(second, first) > Math.atan2(p.second, p.first) ? 1 : -1; // second/firstの昇順にソート
				//return first + second > p.first + p.second ? 1 : -1; //first+secondの昇順にソート
				//return first + second < p.first + p.second ? 1 : -1; //first+secondの降順にソート
				//return first - second < p.first - p.second ? 1 : -1; //first-secondの降順にソート
				//return second - first < p.second - p.first ? 1 : -1; //first-secondの昇順にソート
				//return second - first < p.second - p.first ? -1 : 1; //second-firstの昇順にソート
				//return Math.atan2(second,first) > Math.atan2(p.second, p.first) ? 1 : -1;
		}
  }

	private static class FastScanner {
		private final InputStream in = System.in;
		private final byte[] buffer = new byte[1024];
		private int ptr = 0;
		private int buflen = 0;
		private boolean hasNextByte() {
				if (ptr < buflen) {
						return true;
				}else{
						ptr = 0;
						try {
								buflen = in.read(buffer);
						} catch (IOException e) {
								e.printStackTrace();
						}
						if (buflen <= 0) {
								return false;
						}
				}
				return true;
		}
		private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
		private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
		public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
		public String next() {
				if (!hasNext()) throw new NoSuchElementException();
				StringBuilder sb = new StringBuilder();
				int b = readByte();
				while(isPrintableChar(b)) {
						sb.appendCodePoint(b);
						b = readByte();
				}
				return sb.toString();
		}
		public long nextLong() {
				if (!hasNext()) throw new NoSuchElementException();
				long n = 0;
				boolean minus = false;
				int b = readByte();
				if (b == '-') {
						minus = true;
						b = readByte();
				}
				if (b < '0' || '9' < b) {
						throw new NumberFormatException();
				}
				while(true){
						if ('0' <= b && b <= '9') {
								n *= 10;
								n += b - '0';
						}else if(b == -1 || !isPrintableChar(b)){
								return minus ? -n : n;
						}else{
								throw new NumberFormatException();
						}
						b = readByte();
				}
		}
		public int nextInt() {
				long nl = nextLong();
				if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
				return (int) nl;
		}
		public double nextDouble() { return Double.parseDouble(next());}
	}
}
