#include <bits/stdc++.h>
using namespace std;
#define max(x,y) ((x)>(y)?(x):(y))
inline int read(){
	int f=1,r=0;char c=getchar();
	while(!isdigit(c))f^=c=='-',c=getchar();
	while(isdigit(c))r=(r<<1)+(r<<3)+(c^48),c=getchar();
	return f?r:-r;
}
const int N=2e5+5;
int mx[N<<2],tg[N<<2];
#define ls (p<<1)
#define rs (p<<1|1)
inline void spread(int p){
	if(!tg[p])return;
	tg[ls]+=tg[p],mx[ls]+=tg[p];
	tg[rs]+=tg[p],mx[rs]+=tg[p];
	tg[p]=0;
}
inline void change(int p,int l,int r,int x,int y,int val){
	if(x<=l && r<=y){tg[p]+=val,mx[p]+=val;return;}
	spread(p);int mid=(l+r)>>1;
	if(x<=mid)change(ls,l,mid,x,y,val);
	if(y>mid)change(rs,mid+1,r,x,y,val);
	mx[p]=max(mx[ls],mx[rs]);
}
int main(){
	int n=read(),w=read();
	while(n--){
		int l=read()+1,r=read(),x=read();
		change(1,1,2e5,l,r,x);
		if(mx[1]>w)puts("No"),exit(0);	
	}
	puts("Yes");
	return 0;
}
#include <bits/stdc++.h>
#define rei register int
#define ll long long
using namespace std;

const int N=4e5+100;
int head[N],ver[N],Next[N],tot;
int depth[N],len[N];
int son[N];
int ans[N],cnt;
int root,n;

inline void add(int u,int v){
    ver[++tot]=v;
    Next[tot]=head[u];
    head[u]=tot;
}

void init(int x,int fa){
    depth[x]=depth[fa]+1;
    if(depth[root]<depth[x]) root=x;
    for(rei i=head[x];i;i=Next[i]){
        rei y=ver[i];
        if(y==fa) continue;
        init(y,x);
    }
}

void dfs(int x,int fa){
    for(rei i=head[x];i;i=Next[i]){
        rei y=ver[i];
        if(y==fa) continue;
        dfs(y,x);
        len[x]=max(len[x],len[y]+1);
        if(!son[x] || len[y]>len[ son[x] ]) son[x]=y;
    }
}

void calc(int x,int fa){
    ans[x]=++cnt;
    for(rei i=head[x];i;i=Next[i]){
        rei y=ver[i];
        if(y==fa || y==son[x]) continue;
        calc(y,x);
        ++cnt;
    }
    if(son[x]) calc(son[x],x),++cnt;
}

int main(){
    scanf("%d",&n);
    for(rei i=1;i<n;++i){
        rei x,y;
        scanf("%d%d",&x,&y);
        add(x,y),add(y,x);
    }
    init(1,0);
    dfs(root,0);
    calc(root,0);
    for(rei i=1;i<=n;++i)
        printf("%d ",ans[i]);
    puts("");
    getchar();
    getchar();
    return 0;
}